nexu-io/open-design · error · ValueError
render_for_html_comparison requires at least one report
Error message
render_for_html_comparison requires at least one report
What it means
render_for_html_comparison requires at least one (label, Report) pair because it builds comparison metadata and quality notes by reading entity_reports[0]. An empty list would IndexError at main_report access, so the function guards up front with ValueError.
Source
Thrown at design-templates/last30days/scripts/lib/render.py:218
# the same warnings via collect_html_warnings() routed to stderr by the
# CLI, so they can fix quality issues before sharing.
_append_html_footer(lines, report, save_path)
return "\n".join(lines).strip() + "\n"
def render_for_html_comparison(
entity_reports: list[tuple[str, schema.Report]],
synthesis_md: str | None = None,
*,
save_path: str | None = None,
) -> str:
"""Render comparison markdown intended for shareable HTML conversion.
Same semantics as render_for_html(), but metadata and data quality notes
are aggregated across the compared entities.
"""
if not entity_reports:
raise ValueError("render_for_html_comparison requires at least one report")
entities = [label for label, _ in entity_reports]
main_report = entity_reports[0][1]
meta = (
f"<!-- META: {main_report.range_from} to {main_report.range_to} "
f"· comparing {len(entities)}: {', '.join(entities)} -->"
)
lines = [
*_render_badge(),
meta,
]
if synthesis_md:
lines.extend(["", synthesis_md.strip()])
# Comparison data quality notes also go to stderr, not into the artifact.
_append_html_footer(lines, main_report, save_path)
return "\n".join(lines).strip() + "\n"
View on GitHub (pinned to 5be4028344)
Solutions
- Ensure entity_reports contains at least the main topic's (label, Report) before calling.
- If comparison yielded zero entities, fall back to the single-entity render_for_html(report) path.
- Guard the caller: if not entity_reports, skip rendering or raise a clearer upstream error.
Example fix
# before
md = render_for_html_comparison(entity_reports) # entity_reports == []
# after
if not entity_reports:
md = render_for_html(main_report, save_path=save_path)
else:
md = render_for_html_comparison(entity_reports, save_path=save_path) Defensive patterns
Strategy: validation
Validate before calling
def safe_render_for_html_comparison(entity_reports, synthesis_md=None, save_path=None):
if not entity_reports:
raise ValueError("cannot render comparison: entity_reports is empty")
return render_for_html_comparison(entity_reports, synthesis_md, save_path=save_path) Type guard
null
Try / catch
null
Prevention
- Ensure at least the main topic's (label, Report) is in entity_reports before calling.
- Fall back to the single-entity render_for_html when comparison discovery yields nothing.
- Add an orchestrator-level assert that entity_reports is non-empty.
When it happens
Trigger: Calling render_for_html_comparison([]) directly, or passing the result of a comparison step that produced zero entity reports (e.g. all competitor resolutions failed and the caller did not fall back to the single-entity renderer).
Common situations: Comparison run where every competitor lookup returned empty and the caller forwarded the empty list instead of degrading to render_for_html. Programmatic use that builds entity_reports from a filter that removed everything.
Related errors
- render_comparison_multi requires at least one report
- render_comparison_multi_context requires at least one report
- invalid JSON in ${filePath}: ${message}
- ${filePath} must contain a JSON object
- ARTIFACT_MANIFEST_INVALID
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/db6b8262e68b47c6.
Report an issue: GitHub.