diff --git a/orchestration/scenario_export_orchestrator.py b/orchestration/scenario_export_orchestrator.py index 4166d27c0..282751eb4 100644 --- a/orchestration/scenario_export_orchestrator.py +++ b/orchestration/scenario_export_orchestrator.py @@ -91,6 +91,18 @@ class ScenarioExportOrchestrator: named_sheets.append((self._scenarios.name_for(scenario_id), sheet)) row_count += len(sheet.rows) + if row_count == 0: + # No Property had a default Plan under any requested Scenario (model + # A) — a recorded failure, never an empty workbook emailed (ADR-0065). + raise SubTaskFailure( + "the scenario export selection produced no exportable rows", + details={ + "portfolio_id": portfolio_id, + "scenario_ids": list(scenario_ids), + "property_count": len(property_ids), + }, + ) + data = render_workbook(named_sheets) key = f"{self._key_prefix}/{export_name}.xlsx" self._exports.put_object(key, data)