tirth8205/code-review-graph · error · RuntimeError

{context} reported errors: {details}

Error message

{context} reported errors: {details}

What it means

_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.

Source

Thrown at code_review_graph/incremental.py:1580

# ---------------------------------------------------------------------------
# Watch mode
# ---------------------------------------------------------------------------


_DEBOUNCE_SECONDS = 1


def _raise_watch_update_errors(result: dict, context: str) -> None:
    """Fail the watch boundary when an incremental update reports errors."""
    errors = result.get("errors") or []
    if not errors:
        return
    details = "; ".join(
        f"{error.get('file', 'unknown')}: {error.get('error', 'unknown error')}"
        for error in errors
    )
    raise RuntimeError(f"{context} reported errors: {details}")


def _raise_watch_postprocess_warnings(result: object) -> None:
    """Treat structured post-processing warnings as a failed watch update."""
    if not isinstance(result, dict):
        return
    warnings = result.get("warnings") or []
    if warnings:
        details = "; ".join(str(warning) for warning in warnings)
        raise RuntimeError(f"post-processing reported warnings: {details}")


# ---------------------------------------------------------------------------
# Watch scheduling and supervision
# ---------------------------------------------------------------------------

# A single recursive watch on the repository root makes the OS register one
# watch per directory in the tree — including every temp directory a build tool

View on GitHub (pinned to b58668751a)

Solutions

  1. Fix the file named in the details (often a syntax error mid-edit)
  2. If it's a transient write race, wait for the next watch tick — the file usually reprocesses
  3. Exclude generated/vendored files that consistently fail
  4. Report a parser bug if the file is valid source
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

def has_watch_errors(result: dict) -> bool:
    return bool(result.get("errors"))

Try / catch

try:
    result = watch(...)
except RuntimeError as e:
    if "reported errors" in str(e):
        for part in str(e).split("errors: ", 1)[1].split("; "):
            log.warning("watch file error: %s", part)
        continue  # don't kill the watcher
    raise

Prevention

When it happens

Trigger: A watch/process update whose result dict contains non-empty 'errors' — individual files failed to parse/index during the incremental pass.

Common situations: 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.

Related errors


AI-assisted analysis of tirth8205/code-review-graph@b58668751a (2026-08-28). Data as JSON: /api/errors/2f7bb2c958ef7dcd. Report an issue: GitHub.