parser failed on nested json schema file with comments error
Strict JSON has no comments, so the agent needs a tolerant pre-pass: strip or convert comments with a JSONC-aware parser, or ask the schema owner to publish a clean JSON copy, and validate the stripped document before using it. Use when an agent failing to parse a nested JSON schema file that contains comments. Not for a genuinely malformed JSON file with a syntax error beyond comments, which needs content repair.
TL;DR
Strict JSON has no comments, so the agent needs a tolerant pre-pass: strip or convert comments with a JSONC-aware parser, or ask the schema owner to publish a clean JSON copy, and validate the stripped document before using it. Feeding a commented file to a strict parser will fail on the first comment every time, no matter how valid the underlying schema is.
parser failed on nested json schema file with comments errorUse this when
- The check or run fails with this symptom: the agent's parser errors on the commented, nested JSON schema file.
- You are working on an agent failing to parse a nested JSON schema file that contains comments and the failure repeats on the same data or configuration.
- You need the failing rows, rule, or stage isolated before changing thresholds or code.
Not for this skill when
- A genuinely malformed JSON file with a syntax error beyond comments, which needs content repair instead.
- The error text names a different tool, stage, or root cause. Match the verbatim error first and use that skill.
Steps
- Open the file and locate the comment styles used, line comments, block comments, or trailing commas, which strict JSON also rejects. Verify: the non-strict constructs present are catalogued
- Parse the file with a JSONC-tolerant parser and confirm the resulting structure loads completely. Verify: the tolerant parse produces the full structure
- Validate the parsed document against its meta-schema or a known-good consumer to prove the content survived the tolerant parse. Verify: the parsed schema validates and loads in its consumer
- Add the tolerant parse as the agent's standard pre-step for schema files, with a log line noting comments were stripped. Verify: the pre-step is in the agent's file handling
- If the file is owned by another team, request a strict JSON export alongside the commented source so the workaround can retire. Verify: the request is recorded with the file owner
Variant phrasings
parser failed nested json schema file comments
The verbatim commented-schema phrasing.
jsonc comments strict json parser agent schema
The JSONC phrasing for tolerant parsing.
schema file with comments fails json load
The load-failure phrasing for commented files.
Compatibility: JSON schema files with comments parsed by agents using strict JSON parsers
Why it happens
Teams comment schema files because they are maintained by humans, but the JSON specification never allowed comments, so strict parsers reject the file outright. The schema content is usually fine; the format variant is the whole problem.
Edge cases / pitfalls
- Stripping comments with naive string replacement can corrupt string values containing comment-like sequences. Use a real JSONC parser.
- Trailing commas are the other common non-strict construct; check for them in the same pass.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_s8M3wJlMicDZ4cIV3jI2lg