nautechsystems/nautilus_trader · error

Continuous future requests require `RequestBars`

Error message

Continuous future requests require `RequestBars`

What it means

execute_continuous_future_request only knows how to process RequestCommand::Bars; receiving any other request type means the continuous-future pipeline was invoked incorrectly and the engine bails. Continuous futures are always requested as (aggregated) Bars with continuous parameters.

Source

Thrown at crates/data/src/engine/mod.rs:1393

            RequestCommand::BookDepth(req) => client.request_book_depth(req),
            RequestCommand::Quotes(req) => client.request_quotes(req),
            RequestCommand::Trades(req) => client.request_trades(req),
            RequestCommand::FundingRates(req) => client.request_funding_rates(req),
            RequestCommand::OptionChainReferencePrice(req) => {
                client.request_option_chain_reference_price(req)
            }
            RequestCommand::Bars(req) => client.request_bars(req),
            RequestCommand::Join(_) => {
                anyhow::bail!("RequestJoin must be handled by handle_request_join")
            }
        }?;

        Ok(resolved_client_id)
    }

    fn execute_continuous_future_request(&mut self, req: RequestCommand) -> anyhow::Result<()> {
        let RequestCommand::Bars(parent) = req else {
            anyhow::bail!("Continuous future requests require `RequestBars`");
        };
        let request_id = parent.request_id;
        let Some(continuous_request) = continuous_future_request_from_bars(&parent)? else {
            return Ok(());
        };

        self.ensure_continuous_future_target_instrument(&continuous_request);
        self.prepare_request_bar_aggregators_from_state(
            request_id,
            &continuous_request.request_bar_aggregation,
        )?;

        let response_client_id = match self.resolve_request_client_id(
            parent.client_id.as_ref(),
            Some(&continuous_request.primary_bar_type.instrument_id().venue),
        ) {
            Ok(client_id) => client_id,
            Err(e) => {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure continuous-future requests are constructed as RequestCommand::Bars with continuous futures parameters (e.g. go_back, continuation method in params)
  2. Route non-bars request types through the normal request path instead of the continuous-future one
  3. If writing custom dispatch, match on RequestCommand::Bars before invoking execute_continuous_future_request
  4. Verify no adapter or plugin rewrites the request type before it reaches this path

Example fix

// before
engine.execute_continuous_future_request(RequestCommand::Data(data_req));
// after
engine.execute_continuous_future_request(RequestCommand::Bars(bars_req_with_continuous_params));
Defensive patterns

Strategy: validation

Validate before calling

if !matches!(cmd, RequestCommand::Bars(_)) {
    // route through normal request path, not continuous-future path
    engine.request(cmd);
    return Ok(());
}

Type guard

fn as_bars(cmd: RequestCommand) -> Option<RequestBars> {
    match cmd { RequestCommand::Bars(b) => Some(*b), _ => None }
}

Try / catch

match engine.request(cmd) {
    Err(e) if e.to_string().contains("require `RequestBars`") => {
        log::error!("continuous-future path only accepts Bars: {e}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling execute_continuous_future_request (or a code path that routes requests into it) with a RequestCommand variant other than Bars, e.g. a Data, Instrument, or Join request flagged as a continuous-future request.

Common situations: Custom routing code that sends non-bars requests into the continuous-future path; misconfiguring a continuous futures subscription to use a data type other than bars; internal dispatch bugs after upgrades.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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