nautechsystems/nautilus_trader · error · anyhow::Error

No pool profiler for {instrument_id}; an active data subscri

Error message

No pool profiler for {instrument_id}; an active data subscription is required to quote the swap

What it means

prepare_swap needs the local pool profiler from the cache to quote the swap, but cache.pool_profiler(instrument_id) returned None. The profiler is built by the blockchain data client's subscription pipeline, so absence means there is no active data subscription for that instrument: the execution client deliberately refuses to quote swaps it cannot price locally.

Source

Thrown at crates/adapters/blockchain/src/execution/client.rs:1236

                anyhow::anyhow!("slippage_bps parameter {value} exceeds the u32 range")
            })?,
            None => self.transaction_limits.slippage_bps,
        };

        if slippage_bps > self.transaction_limits.max_slippage_bps {
            anyhow::bail!(
                "Slippage {slippage_bps} bps exceeds the configured `max_slippage_bps` {}",
                self.transaction_limits.max_slippage_bps
            );
        }

        let profiler = self
            .core
            .cache()
            .pool_profiler(&instrument_id)
            .cloned()
            .ok_or_else(|| {
                anyhow::anyhow!(
                    "No pool profiler for {instrument_id}; an active data subscription is required to quote the swap"
                )
            })?;

        if !profiler.is_initialized {
            anyhow::bail!("Pool profiler for {instrument_id} is not initialized");
        }
        let profiler_block = profiler
            .last_processed_event
            .as_ref()
            .map(|position| position.number)
            .ok_or_else(|| {
                anyhow::anyhow!("Pool profiler for {instrument_id} has processed no events")
            })?;

        let zero_for_one = base_token.address == pool.token0.address;
        let quote = profiler
            .swap_exact_in(amount_in, zero_for_one, None)

View on GitHub (pinned to 2114cf6f76)

Solutions

  1. Subscribe to the instrument's data (deltas/quotes for the pool) and wait for the first events before submitting
  2. Verify the instrument_id passed to submit_order exactly matches the subscribed instrument
  3. Confirm the data client is registered and connected in the same NautilusTrader instance
  4. Gate order submission on having seen at least one quote for the instrument

Example fix

# before: order submitted with no data subscription
self.submit_order(self.order_factory.market(...))  # No pool profiler

# after: subscribe first, wait for the first quote, then trade
self.subscribe_quote(instrument_id)
# ... in on_quote / after first callback:
if self.cache.quote_tick(instrument_id) is not None:
    self.submit_order(order)
Defensive patterns

Strategy: validation

Validate before calling

# Gate submission on an active subscription for the instrument
def can_quote(self, instrument_id) -> bool:
    tick = self.cache.quote_tick(instrument_id)  # non-None implies a live subscription produced data
    return tick is not None

# in strategy:
assert self.can_quote(instrument_id), f'no data subscription for {instrument_id}'
self.submit_order(order)

Type guard

def has_pool_data(cache, instrument_id) -> bool:
    """True once the instrument has produced at least one cached quote/delta."""
    return (cache.quote_tick(instrument_id) is not None
            or cache.order_book_delta(instrument_id) is not None)

Prevention

When it happens

Trigger: submit_order for an instrument whose data feed was never subscribed (no request for that pool's events), a subscription that failed or was unsubscribed before the order, or an instrument_id that does not match the subscribed pool's ID format.

Common situations: Strategy submits before subscribe() completes in on_start; typos or venue mismatch in the instrument_id (e.g. WETH-USDC.UNISWAP-V3 vs the actual venue name); running the execution client without its data client counterpart.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@2114cf6f76 (2026-08-21). Data as JSON: /api/errors/05f2b50a283a8cd7. Report an issue: GitHub.