affaan-m/ECC · error · RuntimeError

classifier subprocess failed

Error message

classifier subprocess failed (rc={result.returncode}): {result.stderr[:500]}

What it means

classify_events in skill-comply's classifier.py shells out to a classifier subprocess and raises this RuntimeError when the subprocess exits with a nonzero return code. The first 500 characters of the subprocess's stderr are embedded in the message to surface the underlying tool's diagnostic output.

Solutions

  1. Read the rc and embedded stderr in the message to identify the classifier's own failure, and fix that root cause first.
  2. Verify the classifier binary is installed and on PATH (which <classifier>; run it manually on a small sample).
  3. Check classifier configuration, model files, and version compatibility with the input schema.
  4. Confirm the input passed to the subprocess is well-formed and encodable (UTF-8, expected event shape).
  5. Wrap the call in try/except RuntimeError to convert it into a grading failure with the stderr surfaced to logs.

Example fix

// before: crash propagates raw
result = subprocess.run([...], capture_output=True, text=True, timeout=60)
if result.returncode != 0:
    raise RuntimeError(f"classifier subprocess failed (rc={result.returncode}): {result.stderr[:500]}")

// after: handle gracefully at the call site
try:
    classification = classify_events(events)
except RuntimeError as e:
    logger.error("classifier unavailable: %s", e)
    return grade_result(events, skipped=True)
Defensive patterns

Strategy: try-catch

Validate before calling

import shutil
binary = cmd[0]
if shutil.which(binary) is None:
    raise RuntimeError(f"classifier binary '{binary}' not found on PATH")

Try / catch

try:
    classification = classify_events(events)
except RuntimeError as e:
    log.error("classifier subprocess failed: %s", e)
    # degrade: skip grading or fall back to manual review
except subprocess.TimeoutExpired:
    log.error("classifier timed out after 60s")

Prevention

When it happens

Trigger: The external classifier binary is missing from PATH (rc=127) or not executable (rc=126); the classifier crashes on the input (segfault, unhandled exception, rc=1/2); it exits nonzero due to its own bad configuration, bad model file, or input encoding problems.

Common situations: Fresh machine/container without the classifier installed; wrong CLASSIFIER path or version after an upgrade; classifier model/data files missing or corrupted; input containing characters or sizes the classifier cannot handle.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/3f9e782a9e91d2be. Report an issue: GitHub.

Appendix: source

Thrown at skills/skill-comply/scripts/classifier.py:54

        for i, event in enumerate(trace)
    )

    prompt_template = (PROMPTS_DIR / "classifier.md").read_text()
    prompt = (
        prompt_template
        .replace("{steps_description}", steps_desc)
        .replace("{tool_calls}", tool_calls)
    )

    result = subprocess.run(
        ["claude", "-p", prompt, "--model", model, "--output-format", "text"],
        capture_output=True,
        text=True,
        timeout=60,
    )

    if result.returncode != 0:
        raise RuntimeError(
            f"classifier subprocess failed (rc={result.returncode}): "
            f"{result.stderr[:500]}"
        )

    return _parse_classification(result.stdout)


def _parse_classification(text: str) -> dict[str, list[int]]:
    """Parse LLM classification output into {step_id: [event_indices]}."""
    text = text.strip()
    # Strip markdown fences
    lines = text.splitlines()
    if lines and lines[0].startswith("```"):
        lines = lines[1:]
    if lines and lines[-1].startswith("```"):
        lines = lines[:-1]
    cleaned = "\n".join(lines)

View on GitHub (pinned to 8321021c54)