PDM "Lock file does not match pyproject.toml" / Install Errors in CI
PDM checks that pdm.lock matches the content hash of pyproject.toml. When dependencies changed without re-locking - or the lock is missing - pdm install/pdm sync refuses to proceed in a CI (frozen) context.
What this error means
pdm install or pdm sync fails complaining the lock file does not match pyproject.toml (or that no lock exists). It happens after someone edits dependencies without running pdm lock, or when the lock was never committed.
WARNING: Lock file hash doesn't match pyproject.toml, packages may be outdated.
pdm.lock does not exist or is not up to date. Run `pdm lock` to fix it.Common causes
Dependencies edited without re-locking
A change to [project] dependencies (or an optional group) in pyproject.toml was committed without regenerating pdm.lock, so the content hashes disagree.
Lock missing or not committed
If pdm.lock is gitignored or never generated, CI has nothing to reproduce from and reports the mismatch.
How to fix it
Regenerate and commit the lock
Re-lock after editing dependencies, then commit the result.
pdm lock
git add pdm.lock && git commit -m "Update pdm.lock"Use a frozen, reproducible install in CI
Install strictly from the committed lock so CI fails loudly on drift rather than silently re-resolving.
pdm install --check --frozen-lockfileHow to prevent it
- Run
pdm lockafter everypyproject.tomldependency change. - Commit
pdm.lockto the repo. - Use
pdm install --checkin CI to catch lock drift in PRs.