-
Notifications
You must be signed in to change notification settings - Fork 613
Closed
Labels
feature requestNew feature or request to improve the current logicNew feature or request to improve the current logic
Description
Description:
On a self-hosted runner that is already caching tools, the v4 setup-go action attempts to call tar to extract its mod cache and ends up with a bunch of "Cannot open: File exists" errors, and eventually
Action version:
v4
Platform:
- UbuntumacOSWindowsTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Runner type:
- HostedSelf-hostedTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Tools version:
^1.20
Repro steps:
Run actions/setup-go@v4
with:
go-version: ^1.[2](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:2)0
check-latest: false
token: ***
cache: true
env:
GO111MODULE: on
GOPRIVATE: github.com/xyz/*
SSH_AUTH_SOCK: /tmp/ssh-XXXXXX/agent.1965
SSH_AGENT_PID: 1966
Setup go version spec ^1.20
Found in cache @ /opt/hostedtoolcache/go/1.20.6/x64
Added go to the path
Successfully set up Go version ^1.20
/opt/hostedtoolcache/go/1.20.6/x64/bin/go env GOMODCACHE
/opt/hostedtoolcache/go/1.20.6/x64/bin/go env GOCACHE
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
Received 4194[3](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:3)0[4](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:4) of 9246941[5](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:5)4 (0.5%), 4.0 MBs/sec
Received 11324[6](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:6)208 of 924694154 (12.2%), 54.0 MBs/sec
Received 205520896 of 924694154 (22.2%), 65.3 MBs/sec
Received 3103[7](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:7)[8](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:8)4[9](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:9)6 of 924694154 (33.6%), 74.0 MBs/sec
Received 427819008 of 924694154 (46.3%), 81.6 MBs/sec
Received 536870912 of 924694154 (58.1%), 85.3 MBs/sec
Received 666894336 of 924694154 (72.1%), 90.8 MBs/sec
Received 771751936 of 924694154 (83.5%), 91.9 MBs/sec
Received 872415232 of 924694154 (94.3%), 92.3 MBs/sec
Received 924694154 of 924694154 ([10](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:10)0.0%), 93.3 MBs/sec
Cache Size: ~882 MB (924694[15](https://github.com/xyz/abc/actions/runs/123/job/123#step:5:16)4 B)
/usr/bin/tar -xf /home/runner/work/_temp/c44c4bfb-8a98-491b-b4a7-2f38e4fd677c/cache.tzst -P -C /home/runner/work/abc/abc--use-compress-program unzstd
/usr/bin/tar: ../../../go/pkg/mod/go.temporal.io/sdk@v1.15.0/interceptor/tracing_interceptor.go: Cannot open: File exists
/usr/bin/tar: ../../../go/pkg/mod/go.temporal.io/sdk@v1.15.0/interceptor/tracing_interceptor_test.go: Cannot open: File exists
.
.
.
/usr/bin/tar: Exiting with failure status due to previous errors
Warning: Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
Cache is not found
Expected behavior:
Existing files should be ignored via the -k or --skip-old-files option on tar
Actual behavior:
Existing files are treated as errors.
bc-lee, pratikmallya, tyliec, ponkio-o, hylowaker and 15 more
Metadata
Metadata
Assignees
Labels
feature requestNew feature or request to improve the current logicNew feature or request to improve the current logic
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
dusan-trickovic commentedon Jul 28, 2023
Hello @shaunco ! Thank you for reporting the issue, we will investigate it and get back to you as soon as we have more info :)
shaunco commentedon Jul 28, 2023
Thanks @dusan-trickovic ! Not sure if it is related, but we also seem to end up with quite a few duplicate

setup-goaction caches that all have the same sha256 and need to be cleared out every few days:dsame commentedon Jul 31, 2023
Hello @shaunco,
can you please try to disable caching for the action:
this should solve the problem.
bc-lee commentedon Aug 1, 2023
Based on my understanding,
go getdownloads source codes with write permissions removed. As a result, extracting (tar -xf) cache files toGOPATHmay cause errors. It would be helpful forsetup-goto add write permissions to the cache directory before extracting and remove them after the process is complete.dsame commentedon Aug 1, 2023
@bc-lee Self-hosted runner preserves the cache and builds results so caching does not have sense for them, we should disable caching for them by default. Currently it can be turned off manually
bc-lee commentedon Aug 1, 2023
@dsame Aha, that makes sense. I'm not sure if changing the default based on where the runner is running (i.e., provided by GitHub or self-hosted) is a good idea. I think it would be much better for the user to explicitly specify that option.
dsame commentedon Aug 15, 2023
Hello @bc-lee my motivation to have the different value of
cacheis to have the same omittedcacheinput for both github-hosted and self-hosted builds in the other case users have to have to diffrenet workflows25 remaining items
[`actions/setup-go`] Cache issue (ref actions/cache#1541 + actions/se…
Sync `go-version` in GHA to the one in `go.mod`
go-versionin GHA to the one ingo.modguacsec/guac#2686Sync `go-version` in GHA to the one in `go.mod` (#2686)
priyagupta108 commentedon Jul 21, 2025
Hello @shaunco 👋,
Sorry for the late response.
This is not actually a bug with setup-go. As mentioned in the documentation, setup-go uses toolkit/cache. The root cause of this issue lies in the underlying toolkit (specifically the tar extraction behavior) and is not something unique to
setup-go. For more details about a proposed fix for cache extraction, see actions/toolkit#1891.There are a couple of common workarounds:
Additionally, for those using self-hosted runners and wishing to keep cache enabled, if possible, you can try adjusting the permissions to allow read, write, and execute access on cache directories such as
~/go/pkg/modand~/.cache/go-buildbefore restoring the cache. This may help resolve the issue.Hope this helps!
priyagupta108 commentedon Aug 11, 2025
Hi @shaunco 👋
Just checking in to see if you had a chance to review my previous comment. Let us know if there are any updates or questions.
Thanks!
priyagupta108 commentedon Aug 25, 2025
Hey @shaunco!
Do you have any updates on this issue? Let us know if you have any questions or need clarification. Thanks!
priyagupta108 commentedon Sep 8, 2025
@shaunco,
Just checking in to see if there's any update on this issue. Please let us know if you have any questions or if there's anything we can help clarify. Thanks!
priyagupta108 commentedon Sep 22, 2025
Hello @shaunco,
Closing this issue due to a lack of activity. If you still need assistance, please feel free to reach out. Thank you!