Skip to content

_rust_notify.WatchfilesRustInternalError: error in underlying watcher: IO error for operation on <python path>: No such file or directory (os error 2) #361

@kgaspard

Description

@kgaspard

Description

This issue is effectively a duplicate of #282 - I'm experiencing the same. @samuelcolvin helpfully looked into it and applied a fix, but wasn't able to test on WSL2. I'm on WSL2 and am encountering this issue again.

Note that I tried downgrading watchfiles to 0.21.0 a few weeks ago, which seemed to help (in the sense that the issue seems to pop up after an hour or so rather than minutes), but the issue still persists. Error code in Watchfiles Output below

Example Code

uvicorn src.main:app --host 0.0.0.0 --port "8080" --reload --reload-dir /code/src

Watchfiles Output

Traceback (most recent call last):

  File "/opt/venv/bin/uvicorn", line 7, in <module>

    sys.exit(main())

             ^^^^^^

  File "/opt/venv/lib/python3.12/site-packages/click/core.py", line 1462, in __call__

    return self.main(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/venv/lib/python3.12/site-packages/click/core.py", line 1383, in main

    rv = self.invoke(ctx)

         ^^^^^^^^^^^^^^^^

  File "/opt/venv/lib/python3.12/site-packages/click/core.py", line 1246, in invoke

    return ctx.invoke(self.callback, **ctx.params)

           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/venv/lib/python3.12/site-packages/click/core.py", line 814, in invoke

    return callback(*args, **kwargs)

           ^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/opt/venv/lib/python3.12/site-packages/uvicorn/main.py", line 423, in main

    run(

  File "/opt/venv/lib/python3.12/site-packages/uvicorn/main.py", line 588, in run

    ChangeReload(config, target=server.run, sockets=[sock]).run()

  File "/opt/venv/lib/python3.12/site-packages/uvicorn/supervisors/basereload.py", line 53, in run

    for changes in self:

                   ^^^^

  File "/opt/venv/lib/python3.12/site-packages/uvicorn/supervisors/basereload.py", line 72, in __next__

    return self.should_restart()

           ^^^^^^^^^^^^^^^^^^^^^

  File "/opt/venv/lib/python3.12/site-packages/uvicorn/supervisors/watchfilesreload.py", line 81, in should_restart

    changes = next(self.watcher)

              ^^^^^^^^^^^^^^^^^^

  File "/opt/venv/lib/python3.12/site-packages/watchfiles/main.py", line 122, in watch

    raw_changes = watcher.watch(debounce, step, rust_timeout, stop_event)

                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

_rust_notify.WatchfilesRustInternalError: error in underlying watcher: IO error for operation on /code/src/db/engine.py.isorted: No such file or directory (os error 2) about ["/code/src/db/engine.py.isorted"]

Operating System & Architecture

#1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025

[Local machine]
Windows-10-10.0.19045-SP0
10.0.19045

Environment

Docker on WSL2

Python & Watchfiles Version

Python: 3.12.12 (main, Jan 13 2026, 03:11:57) [GCC 14.2.0]; watchfiles: 0.21.0

Rust & Cargo Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions