Skip to content
Latchkey

pre-commit autoupdate fails or changes revs in CI

autoupdate contacts each hook repo to find the latest tag and rewrites rev. In CI it can fail on network access to a repo, or produce a config change that a later run rejects if a new rev has an incompatible manifest.

What this error means

A scheduled autoupdate job fails while fetching a repo, or the updated config later fails with an InvalidManifestError at the new rev.

pre-commit
[https://github.com/owner/hook-repo] Cannot update because the tip of the
default branch is not a fetchable rev.
Check the log at /root/.cache/pre-commit/pre-commit.log

Common causes

autoupdate cannot fetch a hook repo

Restricted egress or a repo with no fetchable tag on its default branch makes autoupdate unable to determine the latest rev.

The new rev has an incompatible manifest

autoupdate moved a hook to a rev whose manifest or hook ids changed, so a subsequent run fails.

How to fix it

Run autoupdate where the network is allowed

  1. Run pre-commit autoupdate on a step with access to the hook repos.
  2. Review the resulting rev diff before merging.
  3. Run the hooks once against the new revs to confirm they still work.
.github/workflows/ci.yml
- run: pre-commit autoupdate
- run: pre-commit run --all-files

Update a single repo deliberately

Bump one repo at a time so an incompatible rev is easy to isolate.

Terminal
pre-commit autoupdate --repo https://github.com/psf/black

How to prevent it

  • Review autoupdate diffs and run hooks before merging them.
  • Allow hook-repo hosts on the autoupdate runner.
  • Bump repos individually when a bulk update is risky.

Frequently asked questions

What causes "pre-commit autoupdate errors"?
Restricted egress or a repo with no fetchable tag on its default branch makes autoupdate unable to determine the latest rev.
How do I fix pre-commit autoupdate errors?
Run autoupdate where the network is allowed

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card