check-jsonschema "Invalid JSON" parse error in CI
check-jsonschema could not even parse the file as JSON, so validation never started. A trailing comma, a comment, or single quotes makes the JSON invalid.
What this error means
check-jsonschema prints "Failed to parse ...: Invalid JSON" with a line and column, and exits non-zero before any schema check.
check-jsonschema
Error: Failed to parse config.json
Invalid JSON: Expecting property name enclosed in double quotes: line 4 column 3 (char 45)Common causes
A trailing comma or comment in strict JSON
JSON forbids trailing commas and comments; a leftover comma after the last item, or a // comment, breaks the parse.
Single quotes instead of double quotes
JSON strings and keys must use double quotes; single quotes produce "Expecting property name enclosed in double quotes".
How to fix it
Make the file valid JSON
- Go to the reported line:column.
- Remove trailing commas and comments; use double quotes for all strings and keys.
- Re-run check-jsonschema to confirm the parse succeeds.
Terminal
# validate that it is even parseable first
python -m json.tool config.json > /dev/nullUse a JSON5/JSONC-aware source if comments are needed
If you need comments, keep them in a JSON5/JSONC source and emit strict JSON for validation instead of feeding comments to check-jsonschema.
How to prevent it
- Run
json.toolor a formatter to catch parse errors before CI. - Add the pre-commit
check-jsonhook to block invalid JSON. - Do not put comments or trailing commas in
.jsonfiles.
Related guides
pre-commit "check-json...Failed" in CIFix pre-commit "check-json...Failed" in CI - the check-json hook could not parse a .json file (trailing comma…
check-jsonschema "Additional properties are not allowed" in CIFix check-jsonschema "Additional properties are not allowed ('X' was unexpected)" in CI - the document has a…
ajv "schema is invalid" error in CIFix ajv "schema is invalid" in CI - the JSON Schema itself does not conform to its meta-schema, or uses a dra…