affaan-m/ECC · error · RuntimeError

claude -p returned empty output

Error message

claude -p returned empty output

What it means

Empty-output guard in generate_scenarios: claude -p succeeded (rc=0) but produced only whitespace on stdout, so there is no YAML scenario text to parse. Usually a model refusal, truncation, or an output-format mismatch.

Solutions

  1. Re-run the generation; empty replies are often transient
  2. Tighten the scenario_generator prompt to require non-empty YAML output
  3. Check that --output-format text is compatible with the claude version in use
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at skills/skill-comply/scripts/scenario_generator.py:54 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

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

    prompt_template = (PROMPTS_DIR / "scenario_generator.md").read_text()
    prompt = (
        prompt_template
        .replace("{skill_content}", skill_content)
        .replace("{spec_yaml}", spec_yaml)
    )

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

    if result.returncode != 0:
        raise RuntimeError(f"claude -p failed: {result.stderr}")

    if not result.stdout.strip():
        raise RuntimeError("claude -p returned empty output")

    raw_yaml = extract_yaml(result.stdout)
    parsed = yaml.safe_load(raw_yaml)

    scenarios: list[Scenario] = []
    for s in parsed["scenarios"]:
        scenarios.append(Scenario(
            id=s["id"],
            level=s["level"],
            level_name=s["level_name"],
            description=s["description"],
            prompt=s["prompt"].strip(),
            setup_commands=tuple(s.get("setup_commands", [])),
        ))

    return sorted(scenarios, key=lambda s: s.level)

View on GitHub (pinned to 8321021c54)