pre-commit local hooks misconfigured in CI
A repo: local block defines hooks that run tools already on the runner. Each local hook must declare id, name, entry, and language. Omitting one, or picking the wrong language, fails the config or the run.
What this error means
The run fails with an InvalidConfigError on a local repo, or the local hook fails because its entry binary is not installed on the runner.
An error has occurred: InvalidConfigError:
==> At Repository(repo='local')
==> At Hook(id='pytest-check')
=====> Missing required key: languageCommon causes
A local hook omits a required key
Local hooks need id, name, entry, and language; leaving out language (or entry) fails validation.
The entry binary is not on the runner
A language: system local hook calls a tool that CI never installed, so it fails at runtime with a not-found.
How to fix it
Declare all required keys and install the tool
- Add
id,name,entry, andlanguageto each local hook. - Install the tool the
entryinvokes in an earlier CI step. - Re-run so the local hook executes.
- repo: local
hooks:
- id: pytest-check
name: pytest
entry: pytest
language: system
pass_filenames: falseUse a managed language for the local hook
If you do not want to preinstall the tool, let pre-commit build it with a managed language and additional_dependencies.
- repo: local
hooks:
- id: my-lint
name: my lint
entry: my-lint
language: python
additional_dependencies: ['my-lint==1.0.0']How to prevent it
- Give every local hook
id,name,entry, andlanguage. - Install
systemlocal-hook tools before running pre-commit. - Set
pass_filenames: falsefor whole-project commands.