question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Checkout fails to remove .../_work/_temp/... because file is being used by another process

See original GitHub issue

I’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:open
  • Created a year ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
basstringcommented, Oct 21, 2022

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.

1reaction
GCO-NZcommented, Oct 21, 2022

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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git removing references from invalidly, non-existing, c:\tmp\file ...
I found in bitbucket somebody has managed to check in such named file, do not ask me how they managed, but it makes...
Read more >
Fixed: The Process Cannot Access The File Used by Another ...
According to user reports, the “the process cannot access the file because it is being used by another process write to disk” error...
Read more >
During TFS Check-in and Checkout "The process cannot ...
During TFS Check-in and Checkout "The process cannot access the file because it is being used by another process" message occurs.
Read more >
Git checkouts fail on Windows with "Filename too long error
Git checkouts fail on Windows with "Filename too long error: ... 'C:\Program Files\Git\cmd\git.exe' checkout -f master failed with code 1.
Read more >
How to remove checked-out references of a view from a VOB
The checkout may be failing because the file is already checked out reserved to a view that was either removed or is no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found