pre-commit "[ERROR] ... is not a valid ... rev" in CI
pre-commit cloned the hook repo but the rev you pinned is not a real tag or commit there, so the checkout fails. A typo, a deleted tag, or a moved default branch is the usual cause.
What this error means
The run fails early with "[ERROR] <rev> is not a valid <repo> rev" or a git checkout error naming the missing revision.
pre-commit
[ERROR] v99.9.9 is not a valid https://github.com/psf/black rev
Check the log at /root/.cache/pre-commit/pre-commit.logCommon causes
The pinned tag does not exist
You wrote a rev that was never published, or a maintainer removed or renamed the tag, so there is nothing to check out.
A branch name was used where a tag is expected
Pinning to a moving branch that was later deleted or renamed leaves the rev unresolvable.
How to fix it
Pin to a real published tag
- List the hook repo tags to find a valid release.
- Update
revto that exact tag. - Re-run so the checkout resolves.
.pre-commit-config.yaml
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: blackLet autoupdate fix the pin
autoupdate rewrites each rev to the latest tag the repo actually publishes.
Terminal
pre-commit autoupdateHow to prevent it
- Pin to immutable release tags, not branches.
- Run
pre-commit autoupdateon a schedule to keep revs valid. - Review autoupdate diffs before merging so pins stay intentional.
Related guides
pre-commit "InvalidManifestError" from a hook repo in CIFix pre-commit "InvalidManifestError" in CI - the hook repository pre-commit cloned has a .pre-commit-hooks.y…
pre-commit autoupdate fails or changes revs in CIFix pre-commit autoupdate failing in CI - the command cannot reach a hook repo to find its latest tag, or it…
pre-commit "Hook id ... not present in repo" in CIFix pre-commit "Hook id `X` not present in repository ..." in CI - the hook id in your config does not exist…