Skip to content
Latchkey

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

  1. Go to the reported line:column.
  2. Remove trailing commas and comments; use double quotes for all strings and keys.
  3. Re-run check-jsonschema to confirm the parse succeeds.
Terminal
# validate that it is even parseable first
python -m json.tool config.json > /dev/null

Use 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.tool or a formatter to catch parse errors before CI.
  • Add the pre-commit check-json hook to block invalid JSON.
  • Do not put comments or trailing commas in .json files.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →