Checkout fails to remove .../_work/_temp/... because file is being used by another process
See original GitHub issueI’m using self-hosted runner on the latest Windows Server 2022 machine. When using git to download the sources, I constantly hit error like that:
Error: Command failed: rd /s /q "C:\github-runner\_work\_temp\6afb10cc-aa29-4bf3-ae57-aa46fde13a44"
The process cannot access the file because it is being used by another process.
Would it be possible to:
- retry this command
- or continue on error
- or move this command further in the execution?
I have no idea what other process could be using anything in that folder, as Defender is disabled and C:\github-runner_work_temp\ is empty when workflow is stopped.
There is also one other possibility:
You can’t use the rmdir command to delete the current directory. If you attempt to delete the current directory, the following error message appears:
The process can't access the file because it is being used by another process.
But I can’t tell what is the current directory at this particular place in the script.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5
Top GitHub Comments
For anybody else struggling with this, were able to get around this by downgrading checkout version to V2 in the build script. I think the error still occurs but the build continues to completion now.
I’m getting the same issue. Self hosted runner on Windows 2019
Deleting the contents of 'C:\actions-runner1_work\fake-path' Error: Command failed: rd /s /q "C:\actions-runner1_work\fake-path" The directory is not empty.
Only happens sometimes?
Is this directory getting locked maybe by something?