nautechsystems/nautilus_trader · error

Derive only supports L2_MBP order book depth

Error message

Derive only supports L2_MBP order book depth

What it means

Raised by `subscribe_book_depth10` when the requested depth-10 book subscription is not `BookType::L2_MBP`. Like order book deltas, Derive's depth10 feed is only available as level-2 market-by-price, so other book types are rejected.

Source

Thrown at crates/adapters/derive/src/data.rs:850

                    instrument_id,
                    include_expired,
                )
                .await
            {
                lifecycle.rollback(owner, generation);
                log::error!("Lazy-load failed for {instrument_id} (book deltas): {e}");
                return Ok(());
            }

            run_channel_subscribe(lifecycle, owner, generation, request, ws).await
        });

        Ok(())
    }

    fn subscribe_book_depth10(&mut self, cmd: SubscribeBookDepth10) -> anyhow::Result<()> {
        if cmd.book_type != BookType::L2_MBP {
            anyhow::bail!("Derive only supports L2_MBP order book depth");
        }

        let instrument_id = cmd.instrument_id;
        let owner = ChannelOwner::BookDepth10(instrument_id);
        let lifecycle = self.subscription_lifecycle();
        if lifecycle.is_active(owner) {
            return Ok(());
        }

        let instrument_name = format_venue_symbol(&instrument_id)?.to_string();
        let group = orderbook_group(&cmd.params)?;
        let depth = DeriveOrderbookDepth::D10.to_string();
        let channel = orderbook_channel(&instrument_name, &group, &depth);
        let request = ChannelRequest::from_channel(&channel)?;
        let needs_load = self.prepare_subscribe(instrument_id)?;
        let Some(generation) = lifecycle.activate(owner, Some(&channel)) else {
            return Ok(());
        };

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set the subscription's book_type to BookType::L2_MBP.
  2. Use subscribe_book_deltas or ticker feeds instead if only top-of-book data is needed.
  3. Switch venues if a non-L2 book model is a hard requirement.

Example fix

// before
if cmd.book_type != BookType::L2_MBP { /* rejected */ }
// after: construct with
SubscribeBookDepth10 { book_type: BookType::L2_MBP, .. }
Defensive patterns

Strategy: validation

Validate before calling

assert!(matches!(cmd.book_type, BookType::L2_MBP), "Derive depth10 requires L2_MBP");

Try / catch

if cmd.book_type != BookType::L2_MBP {
    log::warn!("coercing depth10 book_type to L2_MBP for Derive");
    cmd.book_type = BookType::L2_MBP;
}

Prevention

When it happens

Trigger: Issuing a SubscribeBookDepth10 command with `book_type` other than L2_MBP against the Derive data client.

Common situations: Depth-10 configs ported from venues with richer book models; generic subscription builders that don't constrain book_type per venue; L1 top-of-book subscriptions attempted through the depth10 channel.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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