{"record":{"id":"f3ec30cc69471e5b","repo":"affaan-m/ECC","slug":"invalid-json-at-line-i-e","errorCode":null,"errorMessage":"Invalid JSON at line {i}: {e}","messagePattern":"Invalid JSON at line (.+?): (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/skill-comply/scripts/parser.py","lineNumber":61,"sourceCode":"    steps: tuple[Step, ...]\n    threshold_promote_to_hook: float\n\n\ndef parse_trace(path: Path) -> list[ObservationEvent]:\n    \"\"\"Parse a JSONL observation trace file into sorted events.\"\"\"\n    if not path.is_file():\n        raise FileNotFoundError(f\"Trace file not found: {path}\")\n\n    text = path.read_text().strip()\n    if not text:\n        return []\n\n    events: list[ObservationEvent] = []\n    for i, line in enumerate(text.splitlines(), 1):\n        try:\n            raw = json.loads(line)\n        except json.JSONDecodeError as e:\n            raise ValueError(f\"Invalid JSON at line {i}: {e}\") from e\n        try:\n            events.append(ObservationEvent(\n                timestamp=raw[\"timestamp\"],\n                event=raw[\"event\"],\n                tool=raw[\"tool\"],\n                session=raw[\"session\"],\n                input=raw.get(\"input\", \"\"),\n                output=raw.get(\"output\", \"\"),\n            ))\n        except KeyError as e:\n            raise ValueError(f\"Missing required field {e} at line {i}\") from e\n\n    return sorted(events, key=lambda e: e.timestamp)\n\n\ndef parse_spec(path: Path) -> ComplianceSpec:\n    \"\"\"Parse a YAML compliance spec file.\"\"\"\n    if not path.is_file():","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/skill-comply/scripts/parser.py#L43-L79","documentation":"JSONL parse guard in parse_trace: a line in the observation trace is not valid JSON, so the event stream cannot be decoded. The offending 1-based line number and the decoder error are included; common causes are truncated writes or interleaved non-JSON log lines.","triggerScenarios":"Thrown at skills/skill-comply/scripts/parser.py:61 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the trace at the reported line and fix or remove the malformed line","Regenerate the trace; a partial line often means the recording process was killed mid-write","Filter out non-JSON preamble lines before parsing if the source emits them"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}