{"record":{"id":"95fee8ce8247bee5","repo":"affaan-m/ECC","slug":"invalid-json-in-config-path","errorCode":null,"errorMessage":"Invalid JSON in config: {path}","messagePattern":"Invalid JSON in config: (.+?)","errorType":"exception","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"skills/python-patterns/SKILL.md","lineNumber":153,"sourceCode":"def render_all(items: list[Renderable]) -> str:\n    \"\"\"Render all items that implement the Renderable protocol.\"\"\"\n    return \"\\n\".join(item.render() for item in items)\n```\n\n## Error Handling Patterns\n\n### Specific Exception Handling\n\n```python\n# Good: Catch specific exceptions\ndef load_config(path: str) -> Config:\n    try:\n        with open(path) as f:\n            return Config.from_json(f.read())\n    except FileNotFoundError as e:\n        raise ConfigError(f\"Config file not found: {path}\") from e\n    except json.JSONDecodeError as e:\n        raise ConfigError(f\"Invalid JSON in config: {path}\") from e\n\n# Bad: Bare except\ndef load_config(path: str) -> Config:\n    try:\n        with open(path) as f:\n            return Config.from_json(f.read())\n    except:\n        return None  # Silent failure!\n```\n\n### Exception Chaining\n\n```python\ndef process_data(data: str) -> Result:\n    try:\n        parsed = json.loads(data)\n    except json.JSONDecodeError as e:\n        # Chain exceptions to preserve the traceback","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/affaan-m/ECC/blob/d8409a4b0813771235555e32e3d8046a73988bfa/skills/python-patterns/SKILL.md#L135-L171","documentation":"Illustrative pattern from the python-patterns skill: the config file was opened successfully but json parsing failed, so the contents are not valid JSON and a ConfigError with the path is raised (chained from JSONDecodeError). The file's contents, not its absence, are the problem.","triggerScenarios":"Thrown at skills/python-patterns/SKILL.md:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Report line/column from the chained JSONDecodeError to the user","Validate configs against a schema after parsing","Fail fast at startup instead of returning partially initialized config"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d8409a4b0813771235555e32e3d8046a73988bfa","analyzedAt":"2026-08-26T12:15:34.022Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}