diff --git a/backend/app/modelling/router.py b/backend/app/modelling/router.py index 6be284523..d71c699f6 100644 --- a/backend/app/modelling/router.py +++ b/backend/app/modelling/router.py @@ -83,6 +83,16 @@ async def trigger_run( properties: list[FilteredProperty] = resolve_filtered_property_ids( session, body.portfolio_id, body.filters ) + if not properties: + # A task with zero sub_tasks could never roll up to complete; the + # app's preview shows the same zero from the same rule (ADR-0056). + raise HTTPException( + status_code=400, + detail=( + f"The filters resolve to no properties in portfolio " + f"{body.portfolio_id} — nothing to distribute." + ), + ) batches = pack_postcode_batches(properties) # Pre-create one sub_task per (scenario, batch) message under the