pre-commit "InvalidManifestError" from a hook repo in CI
pre-commit cloned a hook repo at the pinned rev and tried to read its .pre-commit-hooks.yaml manifest, but the manifest is missing a required field or has an invalid shape at that revision.
What this error means
The run fails with "InvalidManifestError:" naming the cloned repo and the offending key, often a missing entry or language in the manifest at the pinned rev.
An error has occurred: InvalidManifestError:
==> File .pre-commit-hooks.yaml
==> At Hook(id='my-hook')
=====> Missing required key: entry
Check the log at /root/.cache/pre-commit/pre-commit.logCommon causes
The pinned rev predates a manifest field
You pinned rev to a commit where the hook manifest lacked a key that a newer pre-commit requires, so validation fails at that revision.
A malformed local or forked hook manifest
A hand-written .pre-commit-hooks.yaml in a forked repo omits entry, id, or language, or uses a wrong type.
How to fix it
Pin to a rev with a valid manifest
- Check the hook repo tags for a release with a complete manifest.
- Update
revto that tag. - Re-run so pre-commit clones the corrected revision.
- repo: https://github.com/owner/hook-repo
rev: v1.4.0
hooks:
- id: my-hookFix the manifest in a fork or local hook
Ensure each hook entry declares id, name, entry, and language with valid types.
- id: my-hook
name: My hook
entry: my-hook
language: pythonHow to prevent it
- Pin hook repos to tagged releases, not arbitrary commits.
- Validate forked hook manifests before referencing them.
- Run
pre-commit autoupdateto move to a supported rev deliberately.