Rust errors / Build and Cargo
Rust build error · checked with Rust 1.99.0
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
What it meansAnother Cargo process (often your editor's rust-analyzer running cargo check) holds the lock on the package cache or the target folder. Cargo waits until it finishes.
Why it happens
- rust-analyzer or a second terminal running cargo at the same time.
- A crashed cargo process still holding the lock.
How to fix it
1. Wait, or stop the other process
Usually it clears in seconds once the other build ends.
2. Give rust-analyzer its own target dir
Then it never blocks your builds (VS Code settings.json).
"rust-analyzer.cargo.targetDir": true3. Kill a stuck process
Only if no build is really running.
pkill cargo # Windows: taskkill /IM cargo.exe /FOther wordings of this error
blocking waiting for file lock on package cache, blocking waiting for file lock on build directory, cargo stuck waiting for file lock
Other build errors
- error: linker `link.exe` not found
- error: linker `cc` not found
- error: failed to run custom build command for `openssl-sys`
- error: failed to select a version for the requirement
- error: failed to select a version for `libsqlite3-sys`... the package `libsqlite3-sys` lin
- error: could not compile `my-crate` (bin "my-crate") due to 1 previous error
- error: package `foo v1.2.3` cannot be built because it requires rustc 1.80 or newer, while
- feature `edition2024` is required
Up next
Find the right pagePaste any Rust errorCompiler codes and build errors in one finder.Read it next →Also worth your time
Did this answer your question?