Before submitting
Summary
When using pre-commit I do not see an error on a syntactically valid YAML file that contains 89 comment lines in a row, which are used as a template for developers to copy/paste, but with prek I see this error:
some/valid/file.yaml: Failed to yaml decode (error: line 35 column 5: too many consecutive comments before resolving collection entry
--> <input>:35:5
|
33 | # cpu: 500
34 | # memory: 1920
35 | # limits:
| ^ too many consecutive comments before resolving collection entry
36 | # cpu: 600
37 | # memory: 2304
|)
The data structure of the file is like this:
foo:
bar:
# First_comment:
# 88_more_comment_lines:
Something_else:
more_stuff: etc..
Platform
linux, macos
Version (current: 0.4.12)
prek 0.4.11 (92ba6c8 2026-07-25)
.pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-yaml
Log file
$ prek -vvv run check-yaml --all-files
2026-08-07T10:06:45-0400
2026-08-07T14:06:45.908746Z DEBUG prek: 0.4.11 (92ba6c8c2 2026-07-25)
2026-08-07T14:06:45.908790Z DEBUG Args: ["prek", "-vvv", "run", "check-yaml", "--all-files"]
2026-08-07T14:06:45.921708Z TRACE get_root: close time.busy=12.9ms time.idle=2.75µs
2026-08-07T14:06:45.921757Z DEBUG Git root: /Users/danielh/a/prek-demo
2026-08-07T14:06:45.921803Z DEBUG Found workspace root at `/Users/danielh/a/prek-demo`
2026-08-07T14:06:45.921822Z TRACE Include selectors: `check-yaml`
2026-08-07T14:06:45.921829Z TRACE Skip selectors: ``
2026-08-07T14:06:45.921863Z DEBUG discover{root="/Users/danielh/a/prek-demo" config=None refresh=false}: Performing fresh workspace discovery
2026-08-07T14:06:45.921896Z TRACE discover{root="/Users/danielh/a/prek-demo" config=None refresh=false}:list_submodules{git_root="/Users/danielh/a/prek-demo"}: close time.busy=2.75µs time.idle=375ns
2026-08-07T14:06:45.923571Z DEBUG Loading project configuration path=.pre-commit-config.yaml
2026-08-07T14:06:45.930322Z TRACE discover{root="/Users/danielh/a/prek-demo" config=None refresh=false}: close time.busy=8.47ms time.idle=1.08µs
2026-08-07T14:06:45.930491Z TRACE Checking lock resource="store" path=/Users/danielh/.cache/prek/.lock
2026-08-07T14:06:45.930524Z DEBUG Acquired lock resource="store"
2026-08-07T14:06:45.933129Z TRACE No requires-python found in pyproject.toml hook=check-yaml
2026-08-07T14:06:45.933186Z TRACE Released lock path=/Users/danielh/.cache/prek/.lock
2026-08-07T14:06:45.933210Z DEBUG Hooks going to run: ["check-yaml"]
2026-08-07T14:06:45.933233Z TRACE ls_files{cwd="/Users/danielh/a/prek-demo"}: Executing `cd /Users/danielh/a/prek-demo && /opt/homebrew/bin/git -c core.useBuiltinFSMonitor=false --literal-pathspecs ls-files -z -- /Users/danielh/a/prek-demo`
2026-08-07T14:06:45.946122Z TRACE ls_files{cwd="/Users/danielh/a/prek-demo"}: close time.busy=493µs time.idle=12.4ms
2026-08-07T14:06:45.946148Z DEBUG All files in the workspace: 1019
2026-08-07T14:06:45.946314Z TRACE Checking lock resource="store" path=/Users/danielh/.cache/prek/.lock
2026-08-07T14:06:45.946327Z DEBUG Acquired lock resource="store"
2026-08-07T14:06:45.951901Z TRACE Executing `/Users/danielh/.local/share/uv/python/cpython-3.14.6-macos-aarch64-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-08-07T14:06:45.974118Z TRACE Released lock path=/Users/danielh/.cache/prek/.lock
2026-08-07T14:06:45.974182Z TRACE Files for project `.` after filtered: 1019
2026-08-07T14:06:45.974192Z DEBUG Running priority group with priority 0: ["check-yaml"]
2026-08-07T14:06:45.976467Z TRACE matching_filenames{hook="check-yaml"}: close time.busy=2.26ms time.idle=1.62µs
2026-08-07T14:06:45.976487Z TRACE Files for hook `check-yaml` after filtering matched=true filenames=222
2026-08-07T14:06:45.976501Z DEBUG run{hook_id=check-yaml language=python}: Running hook `check-yaml` in fast path
2026-08-07T14:06:46.028195Z TRACE run{hook_id=check-yaml language=python}: close time.busy=50.4ms time.idle=1.26ms
check yaml...............................................................Failed
- hook id: check-yaml
- duration: 0.05s
- exit code: 1
test_file.yaml: Failed to yaml decode (error: line 35 column 5: too many consecutive comments before resolving collection entry
--> <input>:35:5
|
33 | # cpu: 500
34 | # memory: 1920
35 | # limits:
| ^ too many consecutive comments before resolving collection entry
36 | # cpu: 600
37 | # memory: 2304
|)
Before submitting
Summary
When using
pre-commitI do not see an error on a syntactically valid YAML file that contains 89 comment lines in a row, which are used as a template for developers to copy/paste, but withprekI see this error:The data structure of the file is like this:
Platform
linux, macos
Version (current: 0.4.12)
prek 0.4.11 (92ba6c8 2026-07-25)
.pre-commit-config.yaml
Log file