pre-commit "Executable ... not found" for a hook language env in CI
pre-commit set up the hook environment but the entry point binary is not present. Usually the language runtime that pre-commit needs to build the isolated environment is absent from the runner.
What this error means
A hook fails with "Executable <name> not found" before it does any work, meaning the tool was never installed into the hook environment.
Executable `shellcheck` not found
Check the log at /root/.cache/pre-commit/pre-commit.logCommon causes
A system-language hook expects a preinstalled binary
Hooks with language: system do not install anything; they call a binary that must already be on the runner, and it is not.
The language runtime for the env is missing
For a language like golang, ruby, or node, if the runtime is not available pre-commit cannot build the env, so the executable never appears.
How to fix it
Install the required binary or runtime first
- Identify whether the hook is
language: system(needs a preinstalled binary) or a managed language. - Install that binary or runtime in an earlier step.
- Re-run so pre-commit finds or builds the executable.
- run: sudo apt-get update && sudo apt-get install -y shellcheck
- run: pre-commit run --all-filesProvide the runtime for a managed language hook
Use the matching setup action so pre-commit can build the hook environment.
- uses: actions/setup-go@v5
with:
go-version: '1.22'How to prevent it
- Install system-hook binaries explicitly on the runner.
- Provision the language runtime each hook needs before running pre-commit.
- Prefer managed-language hooks over
language: systemwhere possible.