nexu-io/open-design · error · ValueError

render_comparison_multi_context requires at least one report

Error message

render_comparison_multi_context requires at least one report

What it means

render_comparison_multi_context is the context-mode variant of the multi-entity renderer. Like its siblings it reads entity_reports[0] for intent/cluster emission and joins labels with ' vs ', so an empty list is rejected up front.

Source

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

    best_takes = _render_best_takes(
        report.ranked_candidates,
        limit=fun_params["limit"],
        threshold=fun_params["threshold"],
    )
    if best_takes:
        out.extend(best_takes)
        out.append("")

    return out


def render_comparison_multi_context(
    entity_reports: list[tuple[str, schema.Report]],
    cluster_limit: int = 4,
) -> str:
    """Context-mode rendering for the multi-entity comparison."""
    if not entity_reports:
        raise ValueError("render_comparison_multi_context requires at least one report")

    entities = [label for label, _ in entity_reports]
    lines = [
        f"Comparison: {' vs '.join(entities)}",
        f"Entities: {len(entities)}",
        _AI_SAFETY_NOTE,
        "",
    ]
    resolved_block = _render_resolved_entities_block(entity_reports)
    if resolved_block:
        lines.extend(resolved_block)
        lines.append("")
    for label, report in entity_reports:
        lines.append(f"## {label}")
        lines.append(f"Intent: {report.query_plan.intent}")
        if not report.clusters:
            lines.append("- (no significant discussion this month)")
        else:

View on GitHub (pinned to 5be4028344)

Solutions

  1. Ensure at least one (label, Report) pair is passed.
  2. Skip the context renderer and emit a no-data notice when entity_reports is empty.
  3. Route single-entity context through a non-comparison renderer instead.

Example fix

# before
ctx = render_comparison_multi_context(entity_reports)  # []

# after
ctx = (
    render_comparison_multi_context(entity_reports)
    if entity_reports else "(no entities to compare)\n"
)
Defensive patterns

Strategy: validation

Validate before calling

def safe_render_comparison_multi_context(entity_reports, cluster_limit=4):
    if not entity_reports:
        return "(no entities to compare)\n"
    return render_comparison_multi_context(entity_reports, cluster_limit=cluster_limit)

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Calling render_comparison_multi_context([]) from the context/comparison rendering path when the entity list is empty.

Common situations: Context-mode comparison invoked with zero resolved entities. Orchestrator branching to the context renderer without checking that discovery produced at least one entity.

Related errors


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