Skip to content
Latchkey

Poetry "pyproject.toml changed significantly since poetry.lock"

Poetry detected that pyproject.toml was edited but poetry.lock was not regenerated to match. In CI with --no-update or --check, that mismatch is a hard failure.

What this error means

poetry install (or poetry lock --check / poetry check) fails complaining the lockfile is out of date with pyproject.toml. It happens after someone changes a dependency without re-running poetry lock.

poetry output
pyproject.toml changed significantly since poetry.lock was last generated.
Run `poetry lock` to fix the lock file.

Common causes

Dependencies edited without re-locking

A change to pyproject.toml (added/removed/bumped dependency) was committed without regenerating poetry.lock, so the two disagree.

Lockfile not committed

If poetry.lock is gitignored or never committed, CI cannot reproduce the resolved set and flags the mismatch.

How to fix it

Regenerate and commit the lockfile

Re-lock without upgrading unrelated packages, then commit the result.

Terminal
poetry lock --no-update
git add poetry.lock && git commit -m "Update poetry.lock"

Enforce lock freshness in CI

Fail fast if a PR changes dependencies but forgets to re-lock.

.github/workflows/ci.yml
poetry check --lock   # poetry 1.8+
# older: poetry lock --check

How to prevent it

  • Always run poetry lock --no-update after editing pyproject.toml.
  • Commit poetry.lock to the repo.
  • Add a poetry check --lock step to CI to catch drift in PRs.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →