nautechsystems/nautilus_trader · error

No active continuous future request for {request_id}

Error message

No active continuous future request for {request_id}

What it means

dispatch_next_continuous_future_segment looks up the active continuous future request state by request_id; if the map contains no entry for that UUID4, the engine bails because it cannot continue segmenting a request it does not know about.

Source

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

            anyhow::bail!(
                "Cannot request aggregated bars: one of the aggregators in `bar_types` is already running"
            );
        }

        self.request_bar_aggregations
            .insert(request_id, state.clone());

        if let Err(e) = self.init_request_bar_aggregators(request_id, state) {
            self.cleanup_request_bar_aggregators(&request_id);
            return Err(e);
        }

        Ok(())
    }

    fn dispatch_next_continuous_future_segment(&mut self, request_id: UUID4) -> anyhow::Result<()> {
        let Some(state) = self.continuous_future_requests.get(&request_id).cloned() else {
            anyhow::bail!("No active continuous future request for {request_id}");
        };

        let Some(segment) = state
            .request
            .next_segment(state.cursor_ns.as_u64(), state.end_ns.as_u64())
        else {
            self.emit_empty_continuous_future_response(request_id);
            return Ok(());
        };

        self.apply_continuous_future_adjustment(request_id, &state.request, segment.index)?;
        let child = self.build_continuous_future_child_request(request_id, &state, segment);
        if let Some(active) = self.continuous_future_requests.get_mut(&request_id) {
            active.cursor_ns = UnixNanos::from(segment.end_ns.saturating_add(1));
        }

        self.dispatch_request_to_client(child).map(|_| ())
    }

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Verify the request_id passed matches the UUID4 returned from the original continuous bars request
  2. Only call dispatch_next_continuous_future_segment while the continuous request is still active (not after final segment completion)
  3. Re-issue the original continuous bars request if its state has already been consumed
  4. Check for double-completion logic in custom code that might remove the state before a second dispatch

Example fix

// before
engine.dispatch_next_continuous_future_segment(stale_request_id);
// after
engine.request_bars(continuous_bars_req); // re-issue to obtain fresh request_id
engine.dispatch_next_continuous_future_segment(fresh_request_id);
Defensive patterns

Strategy: validation

Validate before calling

// only dispatch while the request state still exists
if engine.get_continuous_future_request(&request_id).is_none() {
    log::warn!("continuous request {request_id} already completed");
    return Ok(());
}

Try / catch

match engine.dispatch_next_continuous_future_segment(request_id) {
    Err(e) if e.to_string().contains("No active continuous future request") => {
        log::warn!("request {request_id} no longer active; re-issue if needed");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling dispatch_next_continuous_future_segment with a request_id that never registered via execute_continuous_future_request, or after the continuous-future request state was already consumed/completed/removed.

Common situations: Calling internal dispatch from custom code with a stale or wrong request ID; continuing pagination after the continuous request finished and its state was deleted; two components racing where one completes and cleans up the request before the other dispatches.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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