{"record":{"id":"2f7bb2c958ef7dcd","repo":"tirth8205/code-review-graph","slug":"context-reported-errors-details","errorCode":null,"errorMessage":"{context} reported errors: {details}","messagePattern":"(.+?) reported errors: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"code_review_graph/incremental.py","lineNumber":1580,"sourceCode":"\n# ---------------------------------------------------------------------------\n# Watch mode\n# ---------------------------------------------------------------------------\n\n\n_DEBOUNCE_SECONDS = 1\n\n\ndef _raise_watch_update_errors(result: dict, context: str) -> None:\n    \"\"\"Fail the watch boundary when an incremental update reports errors.\"\"\"\n    errors = result.get(\"errors\") or []\n    if not errors:\n        return\n    details = \"; \".join(\n        f\"{error.get('file', 'unknown')}: {error.get('error', 'unknown error')}\"\n        for error in errors\n    )\n    raise RuntimeError(f\"{context} reported errors: {details}\")\n\n\ndef _raise_watch_postprocess_warnings(result: object) -> None:\n    \"\"\"Treat structured post-processing warnings as a failed watch update.\"\"\"\n    if not isinstance(result, dict):\n        return\n    warnings = result.get(\"warnings\") or []\n    if warnings:\n        details = \"; \".join(str(warning) for warning in warnings)\n        raise RuntimeError(f\"post-processing reported warnings: {details}\")\n\n\n# ---------------------------------------------------------------------------\n# Watch scheduling and supervision\n# ---------------------------------------------------------------------------\n\n# A single recursive watch on the repository root makes the OS register one\n# watch per directory in the tree — including every temp directory a build tool","sourceCodeStart":1562,"sourceCodeEnd":1598,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/incremental.py#L1562-L1598","documentation":"_raise_watch_update_errors converts structured per-file errors from a watch-mode update into a RuntimeError so watch iterations fail loudly instead of silently skipping files.","triggerScenarios":"A watch/process update whose result dict contains non-empty 'errors' — individual files failed to parse/index during the incremental pass.","commonSituations":"A file with a syntax error or unsupported encoding appears in the repo mid-watch, transient FS race while a file is being written, or a language parser bug triggered by new code.","solutions":["Fix the file named in the details (often a syntax error mid-edit)","If it's a transient write race, wait for the next watch tick — the file usually reprocesses","Exclude generated/vendored files that consistently fail","Report a parser bug if the file is valid source"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"null","typeGuard":"def has_watch_errors(result: dict) -> bool:\n    return bool(result.get(\"errors\"))","tryCatchPattern":"try:\n    result = watch(...)\nexcept RuntimeError as e:\n    if \"reported errors\" in str(e):\n        for part in str(e).split(\"errors: \", 1)[1].split(\"; \"):\n            log.warning(\"watch file error: %s\", part)\n        continue  # don't kill the watcher\n    raise","preventionTips":["Keep files syntactically valid before saving in watched repos (editors' atomic writes help)","Exclude build output/vendored dirs from watching","Log per-file errors and continue watching instead of crashing"],"tags":["watch-mode","incremental-update","file-errors"],"backgroundTag":"background-file-parse-error","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}