Skip to content

Prek==0.3.12 breaks checks in commit-msg stage #2048

@wpk-nist-gov

Description

@wpk-nist-gov

Summary

Using prek==0.3.12 leads to false errors during commit-msg stage. For example, with

#.pre-commit-config.yaml
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-json

running:

prek install
git add .
git commit -m 'dummy'

gives the following output:

Using config file: .pre-commit-config.yaml
check json...........................................(no files to check)Skipped
check json...............................................................Failed
- hook id: check-json
- exit code: 1

  .git/COMMIT_EDITMSG: Failed to json decode (expected value at line 1 column 1)

No such error exists for prek<=0.3.12

Pretty sure this is related to #2043.

Willing to submit a PR?

  • Yes — I’m willing to open a PR to fix this.

Platform

macOS

Version

prek 0.3.12

.pre-commit-config.yaml

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-json

Log file

2026-05-05T15:45:56.804557Z DEBUG prek: 0.3.12 (56d6d0c13 2026-05-05)
2026-05-05T15:45:56.804676Z DEBUG Args: ["/Users/wpk/.local/bin/prek", "hook-impl", "--hook-dir", "/Users/wpk/tmp/dummy/.git/hooks", "--script-version", "4", "--hook-type=commit-msg", "--", ".git/COMMIT_EDITMSG"]
2026-05-05T15:45:56.822204Z TRACE get_root: close time.busy=17.1ms time.idle=11.4µs
2026-05-05T15:45:56.822648Z DEBUG Git root: /Users/wpk/tmp/dummy
2026-05-05T15:45:56.822714Z DEBUG Found workspace root at `/Users/wpk/tmp/dummy`
2026-05-05T15:45:56.822734Z DEBUG Found project root at ``
2026-05-05T15:45:56.822772Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-05-05T15:45:56.823393Z TRACE Executing `/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git ls-files --unmerged`
2026-05-05T15:45:56.837577Z DEBUG Found workspace root at `/Users/wpk/tmp/dummy`
2026-05-05T15:45:56.837635Z TRACE Include selectors: ``
2026-05-05T15:45:56.837651Z TRACE Skip selectors: ``
2026-05-05T15:45:56.838142Z DEBUG discover{root="/Users/wpk/tmp/dummy" config=None refresh=false}: Loaded workspace from cache
2026-05-05T15:45:56.838211Z DEBUG discover{root="/Users/wpk/tmp/dummy" config=None refresh=false}: Loading project configuration path=.pre-commit-config.yaml
2026-05-05T15:45:56.838564Z TRACE discover{root="/Users/wpk/tmp/dummy" config=None refresh=false}: close time.busy=872µs time.idle=3.35µs
2026-05-05T15:45:56.838656Z TRACE Executing `/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git diff --exit-code --name-only -z /Users/wpk/tmp/dummy/.pre-commit-config.yaml`
2026-05-05T15:45:56.865328Z TRACE Checking lock resource="store" path=/Users/wpk/.cache/prek/.lock
2026-05-05T15:45:56.865361Z DEBUG Acquired lock resource="store"
2026-05-05T15:45:56.869452Z TRACE No requires-python found in pyproject.toml hook=check-json
2026-05-05T15:45:56.869708Z DEBUG Hooks going to run: ["check-json"]
2026-05-05T15:45:56.873307Z TRACE Executing `/Users/wpk/Library/Application Support/uv/python/cpython-3.14.3-macos-x86_64-none/bin/python3.14 -I -c import sys, json
info = {
    "version": ".".join(map(str, sys.version_info[:3])),
    "base_exec_prefix": sys.base_exec_prefix,
}
print(json.dumps(info))
 [...]`
2026-05-05T15:45:56.930401Z  WARN Skipping unhealthy installed hook err=Python version mismatch: expected 3.14.2, found 3.14.3 path=/Users/wpk/.cache/prek/hooks/python-xkaAGEivAuqSpfBA8tYJ
2026-05-05T15:45:56.930791Z DEBUG Found installed environment for hook `check-json` at `/Users/wpk/.cache/prek/hooks/python-ZIU1aU7lxMHAzPhSzSoF`
2026-05-05T15:45:56.930887Z TRACE Released lock path=/Users/wpk/.cache/prek/.lock
2026-05-05T15:45:56.930921Z TRACE Executing `/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git diff --diff-filter=A --name-only -z -- /Users/wpk/tmp/dummy`
2026-05-05T15:45:56.943255Z TRACE Executing `/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git write-tree`
2026-05-05T15:45:56.977961Z TRACE Executing `/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git diff-index --binary --exit-code 34d7949229f90fb6736e0d1fa33568353e123b91 -- /Users/wpk/tmp/dummy`
2026-05-05T15:45:57.008759Z DEBUG Working tree is clean
2026-05-05T15:45:57.009016Z TRACE Files for project `.` after filtered: 1
2026-05-05T15:45:57.009057Z TRACE get_diff{path="/Users/wpk/tmp/dummy"}: Executing `/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git diff -- /Users/wpk/tmp/dummy`
2026-05-05T15:45:57.054733Z TRACE get_diff{path="/Users/wpk/tmp/dummy"}: close time.busy=681µs time.idle=45.0ms
2026-05-05T15:45:57.054915Z DEBUG Running priority group with priority 0 with concurrency 16: ["check-json"]
2026-05-05T15:45:57.055037Z TRACE Files for hook `check-json` after filtered: 1
2026-05-05T15:45:57.055406Z DEBUG run{hook_id=check-json language=python}: Running hook `check-json` in fast path
2026-05-05T15:45:57.055862Z TRACE run{hook_id=check-json language=python}: close time.busy=561µs time.idle=169µs
2026-05-05T15:45:57.055936Z TRACE get_diff{path="/Users/wpk/tmp/dummy"}: Executing `/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git diff -- /Users/wpk/tmp/dummy`
2026-05-05T15:45:57.075358Z TRACE get_diff{path="/Users/wpk/tmp/dummy"}: close time.busy=1.99ms time.idle=17.4ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions