{"record":{"id":"634da5d23dd3bc61","repo":"nautechsystems/nautilus_trader","slug":"cannot-build-empty-catalog-response-for-non-catalo","errorCode":null,"errorMessage":"Cannot build empty catalog response for non-catalog-eligible request","messagePattern":"Cannot build empty catalog response for non-catalog-eligible request","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/data/src/engine/streaming.rs","lineNumber":971,"sourceCode":"            cmd.instrument_id,\n            Vec::new(),\n            Some(start),\n            Some(end),\n            ts_init,\n            cmd.params.clone(),\n        )),\n        RequestCommand::BookDepth(cmd) => DataResponse::BookDepth(BookDepthResponse::new(\n            cmd.request_id,\n            resolve_response_client_id(cmd.client_id, used_client_id),\n            cmd.instrument_id,\n            Vec::new(),\n            Some(start),\n            Some(end),\n            ts_init,\n            cmd.params.clone(),\n        )),\n        _ => {\n            anyhow::bail!(\"Cannot build empty catalog response for non-catalog-eligible request\")\n        }\n    };\n\n    Ok(response)\n}\n\nfn build_quotes_catalog_response(\n    cmd: &RequestQuotes,\n    data: Vec<QuoteTick>,\n    start: UnixNanos,\n    end: UnixNanos,\n    used_client_id: Option<ClientId>,\n    ts_init: UnixNanos,\n) -> DataResponse {\n    let params = catalog_response_params(cmd.params.as_ref());\n    DataResponse::Quotes(QuotesResponse::new(\n        cmd.request_id,\n        resolve_response_client_id(cmd.client_id, used_client_id),","sourceCodeStart":953,"sourceCodeEnd":989,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/data/src/engine/streaming.rs#L953-L989","documentation":"build_empty_response constructs an empty catalog response only for catalog-eligible request variants; any other variant is rejected. Like the query_catalog_leg guard, it indicates the request should never have been routed to the catalog pipeline at all.","triggerScenarios":"dispatch_date_range_request finds no catalog match and no resolvable client and calls build_empty_response with a non-catalog-eligible RequestCommand variant; also directly exercised by the test test_build_empty_response_rejects_non_catalog_variant.","commonSituations":"A newly added RequestCommand variant missing match arms in both query_catalog_leg and build_empty_response; misrouting that lets an unsupported variant into the date-range dispatch path.","solutions":["Add the missing variant arm to build_empty_response so it can synthesize an empty response for it","Filter the variant out earlier in dispatch_date_range_request and give it its own dispatch path","Mirror any new RequestCommand variant across query_catalog_leg and build_empty_response in the same change"],"exampleFix":"// before\n_ => anyhow::bail!(\"Cannot build empty catalog response for non-catalog-eligible request\")\n// after\nRequestCommand::MyNewRequest(r) => Ok(empty_response_for(r, ..., ts_init)),\n_ => anyhow::bail!(\"Cannot build empty catalog response for non-catalog-eligible request\")","handlingStrategy":"type-guard","validationCode":"fn can_build_empty(cmd: &RequestCommand) -> bool { is_catalog_eligible(cmd) }","typeGuard":"if !can_build_empty(&cmd) { /* route elsewhere */ }","tryCatchPattern":"match build_empty_response(cmd, ...) { Err(e) if e.to_string().contains(\"non-catalog-eligible\") => skip_or_route(cmd), other => other? }","preventionTips":["Keep the eligible-variant list in one shared helper used by both query_catalog_leg and build_empty_response","Add a unit test per new RequestCommand variant covering the empty-response path"],"tags":["rust","internal-invariant","match-arm","data-engine"],"backgroundTag":"internal-invariant-violation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}