nexu-io/open-design · error · ValueError

render_comparison_multi requires at least one report

Error message

render_comparison_multi requires at least one report

What it means

render_comparison_multi requires at least one entity report because it reads main_label/main_report from entity_reports[0] and joins entity labels with ' vs '. The guard prevents an IndexError and a meaningless empty-title render.

Source

Thrown at design-templates/last30days/scripts/lib/render.py:581

    save_path: str | None = None,
) -> str:
    """Render N (entity, Report) pairs as a single comparison output.

    Reuses _render_comparison_scaffold for the synthesis table and emits
    per-entity evidence sections inside one EVIDENCE FOR SYNTHESIS envelope.
    The single-Report render_compact path is unchanged.

    Args:
        entity_reports: Ordered (label, Report) pairs. The first pair is the
            user's main topic; the remainder are discovered/explicit competitors.
        cluster_limit: Max clusters to surface per entity (kept lower than the
            single-entity default to keep N-way comparisons readable).
        fun_level: Same fun-level knob as render_compact, applied to each
            entity's best-takes block.
        save_path: Optional save-path display string for the footer.
    """
    if not entity_reports:
        raise ValueError("render_comparison_multi requires at least one report")

    entities = [label for label, _ in entity_reports]
    main_label, main_report = entity_reports[0]
    synthesized_topic = " vs ".join(entities)

    lines: list[str] = [
        *_render_badge(),
        f"# last30days v3.0.0: {synthesized_topic}",
        "",
        *_assistant_safety_lines(),
        f"- Comparison mode: {len(entities)} entities ({', '.join(entities)})",
        f"- Date range: {main_report.range_from} to {main_report.range_to}",
        "",
    ]

    aggregated_warnings: list[str] = []
    for label, report in entity_reports:
        aggregated_warnings.extend(f"[{label}] {w}" for w in report.warnings)

View on GitHub (pinned to 5be4028344)

Solutions

  1. Pass at least the main (label, Report) pair into render_comparison_multi.
  2. Downgrade to render_compact(report) when only one entity is available.
  3. Validate entity_reports is non-empty at the comparison orchestrator before dispatching to the renderer.

Example fix

# before
out = render_comparison_multi(entity_reports)  # []

# after
if len(entity_reports) >= 2:
    out = render_comparison_multi(entity_reports)
elif len(entity_reports) == 1:
    out = render_compact(entity_reports[0][1])
else:
    raise ValueError("no entities to render")
Defensive patterns

Strategy: validation

Validate before calling

def safe_render_comparison_multi(entity_reports, **kwargs):
    if not entity_reports:
        raise ValueError("cannot render multi comparison: entity_reports is empty")
    return render_comparison_multi(entity_reports, **kwargs)

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Calling render_comparison_multi([]). Typically reached when the comparison discovery step returned no entities (all competitors unresolved) and the caller did not downgrade to the single-entity render_compact path.

Common situations: Comparison run with zero competitor matches. Filter that drops every entity before render. Caller reused the multi-renderer for a single entity but passed an empty list by mistake.

Related errors


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