uv tool install --force --reinstall mutates the tool environment in place: concurrent readers observe missing files for tens of seconds while the install exits 0
Summary
Summary
uv tool install --force --reinstall <tool> replaces the tool environment in place. A concurrent reader of that environment, such as the running tool itself, or any process importing from its site-packages, observes missing modules and files for the duration of the replacement, while the reinstall exits 0, implying success.
I measured the window with a 10 Hz observer loop: 59 missing samples across ~43 seconds during a single reinstall of a tool with a few hundred files.
This is the reader-side sibling of #12751 (writer-vs-writer on concurrent uv sync). In this bug, for comparison, there there is only one writer, unserialized against readers.
Repro
Terminal A (observer, 10 Hz):
while true; do
~/.local/share/uv/tools/<tool>/bin/python -c "import <package>" 2>/dev/null \
|| echo "MISSING $(date +%H:%M:%S.%N)"
sleep 0.1
doneTerminal B:
uv tool install --force --reinstall <tool>Observed: 59 MISSING lines spread across ~43 s of the reinstall. Interleaving two reinstalls of the same tool makes the window worse and both still exit 0.
Expected
Either:
- the replacement is serialized/atomic — build the new environment in a sibling directory and swap (rename or symlink flip), so a reader never observes a partially populated environment — or
- the window is documented as expected behavior, so callers know to route unattended reinstalls through a build-then-flip mechanism. (And maybe then add an example of this mechanism.)
Workaround
I now install tools into an immutable per-version directory and flip a symlink pointer ourselves; the race becomes impossible rather than detectable. The cost is duplicated disk per version and manual reaping.
Platform
macOS 15.7.3 arm64
Version
uv 0.12.6 (7938ca5d5 2026-08-25)
Python version
Python 3.13.15
Source: astral-sh/uv