Skip to content
Latchkey

Composer "lock file is not up to date" Warning in CI

Composer detected that composer.json was edited but composer.lock was not regenerated to match. The content hash recorded in the lock no longer matches composer.json, so Composer warns (and --strict validation fails).

What this error means

composer install prints "The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them." In CI with composer validate --strict, that mismatch is a hard failure.

composer output
Warning: The lock file is not up to date with the latest changes in composer.json.
You may be getting outdated dependencies. Run update to update them.

Diagnose it: platform requirements and auth

Composer resolves against the PHP version and extensions actually present, so a lockfile that installs locally can be unsatisfiable on a runner with a different PHP build.

Terminal
php -v && php -m | head -30
composer diagnose
composer check-platform-reqs

# install exactly what is locked, non-interactively
composer install --no-interaction --prefer-dist --no-progress

Common causes

Dependencies edited without re-locking

A change to composer.json (added/removed/bumped require) was committed without running composer update, so the lock’s content hash disagrees.

Lockfile not committed

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

How to fix it

Re-lock only what changed, then commit

Update the lock to match composer.json without upgrading unrelated packages.

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

Enforce lock freshness in CI

Fail fast when a PR edits dependencies but forgets to re-lock.

.github/workflows/ci.yml
composer validate --strict

How to prevent it

  • Run composer update --lock (or a scoped update) after editing composer.json.
  • Commit composer.lock to the repo.
  • Add a composer validate --strict step to CI to catch drift in PRs.

Frequently asked questions

What causes Composer "lock file is not up to date" warning in CI?
There are 2 common causes: dependencies edited without re-locking and lockfile not committed. A change to composer.json (added/removed/bumped require) was committed without running composer update, so the lock’s content hash disagrees.
How do I fix Composer "lock file is not up to date" warning in CI?
There are 2 fixes depending on which cause you have: re-lock only what changed, then commit and enforce lock freshness in ci. Work through them in order, since the first is the most common.
What does Composer "lock file is not up to date" warning in CI actually mean?
composer install prints "The lock file is not up to date with the latest changes in composer.json.
How do I stop Composer "lock file is not up to date" warning in CI happening again?
Run composer update --lock (or a scoped update) after editing composer.json. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card