EEXIST err on windows when adding to cache.
Description:
EEXIST on windows when adding to cache.
Setup go version spec 1.17
Attempting to download 1.17...
matching 1.17...
Acquiring 1.17.13 from https://github.com/actions/go-versions/releases/download/1.17.13-2779743212/go-1.17.13-win32-x64.zip
Extracting Go...
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'D:\Users\cloudwego\actions-runner\_work\_temp\go-1.17.13-win32-x64.zip' -DestinationPath 'D:\Users\cloudwego\actions-runner\_work\_temp\7aab9b3[8](https://github.com/cloudwego/hertz/actions/runs/13171441602/job/36766483015#step:3:9)-3551-4f2b-8256-964286efbe30' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('D:\Users\cloudwego\actions-runner\_work\_temp\go-1.17.13-win32-x64.zip', 'D:\Users\cloudwego\actions-runner\_work\_temp\7aab[9](https://github.com/cloudwego/hertz/actions/runs/13171441602/job/36766483015#step:3:10)b38-3551-4f2b-8256-964286efbe30', $true) }"
Successfully extracted go to D:\Users\cloudwego\actions-runner\_work\_temp\7aab9b38-3551-4f2b-8256-964286efbe30
Adding to the cache ...
EEXIST: file already exists, symlink 'D:\Users\cloudwego\actions-runner\_work\_tool\go\1.17.13\x64' -> 'D:\Users\cloudwego\actions-runner\_work\_tool\go\1.17.13\x64'
Falling back to download directly from Go
Install from dist
Acquiring go1.17.13 from https://storage.googleapis.com/golang/go1.17.13.windows-amd64.zip
Extracting Go...
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'D:\Users\cloudwego\actions-runner\_work\_temp\go1.17.[13](https://github.com/cloudwego/hertz/actions/runs/13171441602/job/36766483015#step:3:14).windows-amd64.zip' -DestinationPath 'D:\Users\cloudwego\actions-runner\_work\_temp\7ce9b72f-9f68-4f76-aa7f-f1f7b8fffbf6' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('D:\Users\cloudwego\actions-runner\_work\_temp\go1.17.13.windows-amd64.zip', 'D:\Users\cloudwego\actions-runner\_work\_temp\7ce9b72f-9f68-4f76-aa7f-f1f7b8fffbf6', $true) }"
Successfully extracted go to D:\Users\cloudwego\actions-runner\_work\_temp\7ce9b72f-9f68-4f76-aa7f-f1f7b8fffbf6
Adding to the cache ...
Error: Failed to download version 1.[17](https://github.com/cloudwego/hertz/actions/runs/13171441602/job/36766483015#step:3:18): Error: EEXIST: file already exists, symlink 'D:\Users\cloudwego\actions-runner\_work\_tool\go\1.17.13\x64' -> 'D:\Users\cloudwego\actions-runner\_work\_tool\go\1.17.13\x64'
Action version:
actions/setup-go@v5
Platform:
- [ ] Ubuntu
- [ ] macOS
- [x] Windows
Runner type:
- [ ] Hosted
- [x] Self-hosted
Tools version:
go1.17
Repro steps:
https://github.com/cloudwego/hertz/actions/runs/13171441602/job/36766483015
Expected behavior:
no error
Actual behavior:
error with EEXIST
It only happens when the first run we setup a new env.
and the next run will be
Found in cache @ D:\Users\cloudwego\actions-runner\_work\_tool\go\1.17.13\x64
I think it's not caused by go version. it also reproduced here: https://github.com/cloudwego/hertz/actions/runs/13171441602/job/36766961921
Hi @xiaost, Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.
I am having this same error using setup-go@v4:
Successfully extracted go to C:\actions-runner-m0rFq_work_temp\e6f1231e-8acf-471e-acab-3c810beba5f0 Adding to the cache ... Error: Failed to download version 1.23: Error: EEXIST: file already exists, symlink 'D:\actions-runner-m0rFq_work_tool\go\1.23.6\x64' -> 'D:\actions-runner-m0rFq_work_tool\go\1.23.6\x64'
But at least in my case it doesn't happen the first time, it happens on the second time when the file is already there.
I was actually able to make this error stop happening by just deleting the entire _work\_tool|go directory with this command:
- name: Cleanup Workdir to workaround a setup-go bug
# The bug mentioned above causes setup-go to fail downloading
# Golang because "the file already exists", but disabling
# cache doesn't fix it, so we'll just delete it manually.
run: |
if (Test-Path "${{ github.workspace }}\..\..\_tool\go") {
Remove-Item -Path "${{ github.workspace }}\..\..\_tool\go" -Recurse -Force;
}
But then I don't have the cache which means the Windows CI is taking a long time to finish, as it has to download and install Golang everytime.
Hi there 👋, Thank you for your report. I have attempted to reproduce the issue on my end but was unable to do so. Could you please try setting the environment variable AGENT_ISSELFHOSTED=1 in your workflow?
on:
...
env:
AGENT_ISSELFHOSTED: 1
Thanks @priyagupta108 , it works now. is the env var required for self-hosted runners? didn't know.
we're testing self-hosted windows. Didn't see this err on Linux before.
Setup go version spec stable
stable version resolved as 1.24.0
Attempting to download 1.24.0...
matching 1.24.0...
Acquiring 1.24.0 from https://github.com/actions/go-versions/releases/download/1.24.0-13277276272/go-1.24.0-win32-x64.zip
Extracting Go...
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath 'D:\Users\cloudwego\actions-runner\_work\_temp\go-1.24.0-win32-x64.zip' -DestinationPath 'D:\Users\cloudwego\actions-runner\_work\_temp\dec3[8](https://github.com/cloudwego/hertz/actions/runs/13176018484/job/37212393077#step:3:9)1e9-659f-46f4-9fde-9b5862075237' -Force } else {[System.IO.Compression.ZipFile]::ExtractToDirectory('D:\Users\cloudwego\actions-runner\_work\_temp\go-1.24.0-win32-x64.zip', 'D:\Users\cloudwego\actions-runner\_work\_temp\dec381e[9](https://github.com/cloudwego/hertz/actions/runs/13176018484/job/37212393077#step:3:10)-659f-46f4-9fde-9b5862075237', $true) }"
Successfully extracted go to D:\Users\cloudwego\actions-runner\_work\_temp\dec381e9-659f-46f4-9fde-9b5862075237
Adding to the cache ...
Successfully cached go to D:\Users\cloudwego\actions-runner\_work\_tool\go\1.24.0\x64
Added go to the path
Successfully set up Go version stable
go version go1.24.0 windows/amd64
By the way, I almost forgot to answer, adding AGENT_ISSELFHOSTED=1 also fixed the issue for me.
Hello 👋,
Thank you for your update. As a temporary workaround, setting the AGENT_ISSELFHOSTED=1 environment variable effectively addressed conditions specific to Windows self-hosted runners.
We’re pleased to inform you that a permanent solution has now been implemented as part of the recent pull request #556 and it is now available in the main branch. For now, you can use actions/setup-go@main in your workflows, and these changes will be included in the upcoming releases.
We are proceeding to close the issue. Please feel free to reach out if you have any further concerns or need additional assistance. Thank you!