Safeguard
Application Security•

uv lock check and the locked flag: Fail CI on a Stale Lockfile

uv sync with the locked flag errors when uv.lock is out of date, while the frozen flag skips the check. We reproduce both with uv 0.13.1, released 14 October 2026.

Safeguard Security Team
2 min read

uv 0.13.1 was released on 14 October 2026, and the two flags that matter most for CI are the same as in earlier versions: --locked fails when uv.lock is out of date, and --frozen uses it without asking. Picking the wrong one means a pipeline that installs something different from what a reviewer approved.

What's affected

Any Python project using uv where pyproject.toml can change without uv.lock changing with it. The docs describe the behavior this way:

  • --locked: "If the lockfile is not up-to-date, uv will raise an error instead of updating the lockfile."
  • --frozen: use the lockfile "without checking if it is up-to-date".
  • uv lock --check is equivalent to --locked for other commands.

What to do now

  1. Create the drift. Add a dependency to pyproject.toml by hand without running uv lock.
  2. Check the lockfile:
uv lock --check

On our test project this printed the following and exited 1:

error: The lockfile at `uv.lock` needs to be updated, but `--check` was provided.

hint: To update the lockfile, run `uv lock`.
  1. Install with the strict flag:
uv sync --locked

It failed with the same error and exit code 1, and installed nothing.

  1. Compare with the permissive flag. uv sync --frozen on the same drifted project succeeded with exit code 0 and did not complain about the new dependency.
  2. Use uv sync --locked in CI and uv lock --check as a fast pre-commit or pull request check.
  3. Reserve --frozen for cases where you have verified the lock another way, such as a build that runs right after a lock check.

Quick check

Which flag would let a stale uv.lock reach production unnoticed?

--frozen. It skips the up-to-date check, so changes in pyproject.toml are ignored.

Sources

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.