nexu-io/open-design · error · SystemExit

Unsupported emit mode: {emit}

Error message

Unsupported emit mode: {emit}

What it means

In the single-entity output path (emit_output around line 138), the function dispatches on the `emit` string to json.dumps, html_render.render_html, render.render_compact (compact/md), or render.render_context. Any other value falls through to `raise SystemExit(f"Unsupported emit mode: {emit}")`. This guards the `--emit` CLI flag value before any rendering work.

Source

Thrown at design-templates/last30days/scripts/last30days.py:138

def emit_output(
    report: schema.Report,
    emit: str,
    fun_level: str = "medium",
    save_path: str | None = None,
    synthesis_md: str | None = None,
) -> str:
    if emit == "json":
        return json.dumps(schema.to_dict(report), indent=2, sort_keys=True)
    if emit == "html":
        return html_render.render_html(
            report, fun_level=fun_level, save_path=save_path, synthesis_md=synthesis_md,
        )
    if emit in {"compact", "md"}:
        return render.render_compact(report, fun_level=fun_level, save_path=save_path)
    if emit == "context":
        return render.render_context(report)
    raise SystemExit(f"Unsupported emit mode: {emit}")


def emit_comparison_output(
    entity_reports: list[tuple[str, schema.Report]],
    emit: str,
    fun_level: str = "medium",
    save_path: str | None = None,
    synthesis_md: str | None = None,
) -> str:
    if emit == "json":
        payload = {
            "comparison": True,
            "entities": [label for label, _ in entity_reports],
            "reports": [
                {"entity": label, "report": schema.to_dict(report)}
                for label, report in entity_reports
            ],
        }

View on GitHub (pinned to 5be4028344)

Solutions

  1. Use one of the supported values: json, html, compact, md, context.
  2. For Markdown use `--emit md` (not 'markdown').
  3. Pass the value lowercase; this dispatcher does not normalize case.

Example fix

# before
python3.12 last30days.py --topic x --emit markdown
# after
python3.12 last30days.py --topic x --emit md
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {'json', 'html', 'compact', 'md', 'context'}
if emit not in SUPPORTED:
    raise ValueError(f'--emit must be one of {sorted(SUPPORTED)}, got {emit!r}')

Prevention

When it happens

Trigger: Passing `--emit csv`, `--emit markdown` (note: 'md' is valid, 'markdown' is not), `--emit XML`, or any value outside {json, html, compact, md, context} on a single-entity (non-comparison) run.

Common situations: Guessing a flag value; using 'markdown' instead of 'md'; leftover flag from a different tool; case mismatch (`--emit JSON` is not equal to 'json' since there is no lowercasing here).

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/4a84b39bcbb08ec5. Report an issue: GitHub.