Unexpected error - could not rmdir

I am just starting out with DVC. I am on Windows, Powershell 7, using the windows installer (more version info below). I have done all the suggestions from the “Running DVC on Windows” page. Unfortunately, WSL is not an option at the moment.

DVC is working in a trivial project created from scratch, so it fundamentally works on my system :slight_smile:

When I try and use it in my real-work-project (an untidy monorepo of everything I have done in this project over the last 4 years - it has submodules, C code, python code, latex, …)

My DVC file is trivial:

stages:
  hello:
    cmd: echo "Hello" > output.txt
    outs:
      - output.txt

To reproduce, I delete the .dvc directory, run dvc init

dvc exp run gives strange results. Usually, it appears to do nothing (no output, after a pause of 10 sec or so). Sometimes it reports trying to rmdir some random folder which is unconnected with the DVC configuration, often (but not always) one of the submodules. (-v log below).

I have also (sometimes) observed the dvc.yaml file being updated to an “older” version -perhaps the most recent git commit? I can see my editor auto-refreshing it) while dvc exp run executes. It reverts back to my current version at the end of the run.

dvc repro runs the cmd and creates output.txt. After this, dvc exp run still produces no output or an error relating to rmdir.

Any suggestions gratefully received :slight_smile:

PS C:\_prj\<redacted>> dvc exp run -v
2025-07-19 11:47:31,707 DEBUG: v3.61.0 (exe), CPython 3.12.10 on Windows-11-10.0.22631-SP0
2025-07-19 11:47:31,707 DEBUG: command: exp run -v
2025-07-19 11:47:50,234 ERROR: unexpected error - 8b56f3059da5e09bdddc74a57dc6f1ee9ae76a31: could not rmdir 'C:/_prj/<redacted>/src/<redacted>/PC/ConsoleApplication1/tqdm.cpp/': The process cannot access the file because it is being used by another process.
Traceback (most recent call last):
  File "dvc\cli\__init__.py", line 211, in main
  File "dvc\cli\command.py", line 30, in do_run
  File "dvc\commands\experiments\run.py", line 14, in run
  File "dvc\repo\experiments\__init__.py", line 354, in run
  File "dvc\repo\__init__.py", line 58, in wrapper
  File "dvc\repo\experiments\run.py", line 77, in run
  File "dvc\repo\experiments\__init__.py", line 125, in reproduce_one
  File "dvc\repo\experiments\__init__.py", line 136, in queue_one
  File "dvc\repo\experiments\__init__.py", line 218, in new
  File "dvc\repo\experiments\queue\workspace.py", line 38, in put
  File "dvc\repo\experiments\queue\base.py", line 349, in _stash_exp
  File "scmrepo\git\stash.py", line 43, in push
  File "scmrepo\git\__init__.py", line 307, in _backend_func
  File "scmrepo\git\backend\pygit2\__init__.py", line 854, in reset
OSError: 8b56f3059da5e09bdddc74a57dc6f1ee9ae76a31: could not rmdir 'C:/_prj/<redacted>/src/<redacted>/PC/ConsoleApplication1/tqdm.cpp/': The process cannot access the file because it is being used by another process.


2025-07-19 11:47:50,547 DEBUG: link type reflink is not available ([Errno 129] no more link types left to try out)
2025-07-19 11:47:50,547 DEBUG: Removing 'C:\_prj\.3lZPV1j5rw8bMr4v1Ye87g.tmp'
2025-07-19 11:47:50,548 DEBUG: Removing 'C:\_prj\.3lZPV1j5rw8bMr4v1Ye87g.tmp'
2025-07-19 11:47:50,550 DEBUG: Removing 'C:\_prj\.3lZPV1j5rw8bMr4v1Ye87g.tmp'
2025-07-19 11:47:50,554 DEBUG: Removing 'C:\_prj\<redacted>\.dvc\cache\files\md5\.Zfcw_tuTf-YIVSmurn-gYA.tmp'
2025-07-19 11:47:50,559 DEBUG: Version info for developers:
DVC version: 3.61.0 (exe)
-------------------------
Platform: Python 3.12.10 on Windows-11-10.0.22631-SP0
Subprojects:

Supports:
        azure (adlfs = 2024.12.0, knack = 0.12.0, azure-identity = 1.23.0),
        gdrive (pydrive2 = 1.21.3),
        gs (gcsfs = 2025.5.1),
        hdfs (fsspec = 2025.5.1, pyarrow = 20.0.0),
        http (aiohttp = 3.12.13, aiohttp-retry = 2.9.1),
        https (aiohttp = 3.12.13, aiohttp-retry = 2.9.1),
        oss (ossfs = 2025.5.0),
        s3 (s3fs = 2025.5.1, boto3 = 1.38.27),
        ssh (sshfs = 2025.2.0),
        webdav (webdav4 = 0.10.0),
        webdavs (webdav4 = 0.10.0),
        webhdfs (fsspec = 2025.5.1)
Config:
        Global: C:\Users\<redacted>\AppData\Local\iterative\dvc
        System: C:\ProgramData\iterative\dvc
Cache types: hardlink, symlink
Cache directory: NTFS on C:\
Caches: local
Remotes: None
Workspace directory: NTFS on C:\
Repo: dvc, git
Repo.site_cache_dir: C:\ProgramData\iterative\dvc\Cache\repo\5fe1297d288ea50fec2b8b984e89d658

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!
2025-07-19 11:47:50,562 DEBUG: Analytics is disabled.