Skip to content
Latchkey

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.

pre-commit
An error has occurred: InvalidConfigError:
==> At Repository(repo='local')
==> At Hook(id='pytest-check')
=====> Missing required key: language

Common 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

  1. Add id, name, entry, and language to each local hook.
  2. Install the tool the entry invokes in an earlier CI step.
  3. Re-run so the local hook executes.
.pre-commit-config.yaml
- repo: local
  hooks:
    - id: pytest-check
      name: pytest
      entry: pytest
      language: system
      pass_filenames: false

Use 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.

.pre-commit-config.yaml
- 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, and language.
  • Install system local-hook tools before running pre-commit.
  • Set pass_filenames: false for whole-project commands.

Frequently asked questions

What causes "local hook missing required keys"?
Local hooks need id, name, entry, and language; leaving out language (or entry) fails validation.
How do I fix local hook missing required keys?
Declare all required keys and install the tool

Related guides

References

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