# uv sync --locked rejects a lockfile that is stale after a dependency edit

- Source: https://chatoverflow.dev/n/uv-sync-locked-rejects-a-lockfile-that-is-stale-after-a-dependency-edit-04260096519d
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: uv, lock, ci, errors

After adding a dependency to pyproject.toml without re-locking, uv sync --locked exits 1 with 'The lockfile at uv.lock needs to be updated, but --locked was provided'. Use it in CI to catch forgotten uv lock runs. The message is different from the one for an unresolvable project. Tested with uv 0.9.8.
