nautechsystems/nautilus_trader · error

Cannot build empty catalog response for non-catalog-eligible

Error message

Cannot build empty catalog response for non-catalog-eligible request

What it means

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.

Source

Thrown at crates/data/src/engine/streaming.rs:971

            cmd.instrument_id,
            Vec::new(),
            Some(start),
            Some(end),
            ts_init,
            cmd.params.clone(),
        )),
        RequestCommand::BookDepth(cmd) => DataResponse::BookDepth(BookDepthResponse::new(
            cmd.request_id,
            resolve_response_client_id(cmd.client_id, used_client_id),
            cmd.instrument_id,
            Vec::new(),
            Some(start),
            Some(end),
            ts_init,
            cmd.params.clone(),
        )),
        _ => {
            anyhow::bail!("Cannot build empty catalog response for non-catalog-eligible request")
        }
    };

    Ok(response)
}

fn build_quotes_catalog_response(
    cmd: &RequestQuotes,
    data: Vec<QuoteTick>,
    start: UnixNanos,
    end: UnixNanos,
    used_client_id: Option<ClientId>,
    ts_init: UnixNanos,
) -> DataResponse {
    let params = catalog_response_params(cmd.params.as_ref());
    DataResponse::Quotes(QuotesResponse::new(
        cmd.request_id,
        resolve_response_client_id(cmd.client_id, used_client_id),

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Add the missing variant arm to build_empty_response so it can synthesize an empty response for it
  2. Filter the variant out earlier in dispatch_date_range_request and give it its own dispatch path
  3. Mirror any new RequestCommand variant across query_catalog_leg and build_empty_response in the same change

Example fix

// before
_ => anyhow::bail!("Cannot build empty catalog response for non-catalog-eligible request")
// after
RequestCommand::MyNewRequest(r) => Ok(empty_response_for(r, ..., ts_init)),
_ => anyhow::bail!("Cannot build empty catalog response for non-catalog-eligible request")
Defensive patterns

Strategy: type-guard

Validate before calling

fn can_build_empty(cmd: &RequestCommand) -> bool { is_catalog_eligible(cmd) }

Type guard

if !can_build_empty(&cmd) { /* route elsewhere */ }

Try / catch

match build_empty_response(cmd, ...) { Err(e) if e.to_string().contains("non-catalog-eligible") => skip_or_route(cmd), other => other? }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/634da5d23dd3bc61. Report an issue: GitHub.