checkout: checkout@v3 failed on windows2022 self-hosted runner, reporting Error: File was unable to be removed Error: EBUSY: resource busy or locked

checkout@v3 reporting below error on my windows2022 self-hosted runner, but checkout@v2 works ok!

C:\actions-runner\windows2022-003_work_actions\actions\checkout\v3\dist\index.js:6844 throw new Error(File was unable to be removed ${err}); ^

Error: File was unable to be removed Error: EBUSY: resource busy or locked, rmdir ‘C:\actions-runner\windows2022-003_work_temp\dcd7fd89-dafd-4a46-b292-3c1c71a82794’ at Object.<anonymous> (C:\actions-runner\windows2022-003_work_actions\actions\checkout\v3\dist\index.js:6844:19) at Generator.throw (<anonymous>) at rejected (C:\actions-runner\windows2022-003_work_actions\actions\checkout\v3\dist\index.js:6738:65)

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 10
  • Comments: 18 (3 by maintainers)

Most upvoted comments

Running this in PowerShell as Administrator will fix it:

git config --system core.usebuiltinfsmonitor false

I have tried v3 and v4 , I’m facing the same issues, but when I tried v2, its working fine without any errors

Some background:

On Windows we found that actions/checkout did not respect the Windows FileShare settings previously. So after https://github.com/actions/toolkit/pull/1373 it’s possible to get this error if you have an open file and try to delete it. From researching the linked PR, that seemed like normal Windows behavior hence the change. This was not back-ported into actions/checkout@v2 since that has Node 12 support and Node only introduced its rm -rf feature in Node 14. You can also use actions/checkout@v3.3.0 to remain unblocked.

Can you tell us more about the file and your workflow or show us logs from a run? I would want to know what holds open the lock and how the file was opened. This way we can make sure that this gets closed before deleting the repository or we have additional logic to handle this.