nautechsystems/nautilus_trader · error

RPC parsing of SetFeeProtocol event is not defined in this d

Error message

RPC parsing of SetFeeProtocol event is not defined in this dex: {}:{}

What it means

Raised by `DexExtended::parse_fee_protocol_update_event_rpc` when the DEX has no RPC parser registered for the SetFeeProtocol event (`parse_fee_protocol_update_event_rpc_fn` is `None`). Fee-protocol updates are PancakeSwap-V3-specific; adapters for DEXes that never emit this event (or that only support Hypersync parsing of it) leave the optional fn unset, and this method bails with chain and DEX name.

Source

Thrown at crates/adapters/blockchain/src/exchanges/extended.rs:563

                self.dex.chain,
                self.dex.name
            )
        }
    }

    /// Parses a `SetFeeProtocol` event from an RPC log.
    ///
    /// # Errors
    ///
    /// Returns an error if the DEX does not have an RPC `SetFeeProtocol` event parser defined or if parsing fails.
    pub fn parse_fee_protocol_update_event_rpc(
        &self,
        log: &RpcLog,
    ) -> anyhow::Result<FeeProtocolUpdateEvent> {
        if let Some(parse_fn) = &self.parse_fee_protocol_update_event_rpc_fn {
            parse_fn(self.dex.clone(), log)
        } else {
            anyhow::bail!(
                "RPC parsing of SetFeeProtocol event is not defined in this dex: {}:{}",
                self.dex.chain,
                self.dex.name
            )
        }
    }

    /// Parses a `CollectProtocol` event from an RPC log.
    ///
    /// # Errors
    ///
    /// Returns an error if the DEX does not have an RPC `CollectProtocol` event parser defined or if parsing fails.
    pub fn parse_fee_protocol_collect_event_rpc(
        &self,
        log: &RpcLog,
    ) -> anyhow::Result<FeeProtocolCollectEvent> {
        if let Some(parse_fn) = &self.parse_fee_protocol_collect_event_rpc_fn {
            parse_fn(self.dex.clone(), log)

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Register the SetFeeProtocol RPC parser via `parse_fee_protocol_update_event_rpc_fn: Some(parsing::pancakeswap_v3::fee_protocol_update::parse_fee_protocol_update_event_rpc)` for DEXes that emit the event.
  2. Only dispatch SetFeeProtocol logs to DEX adapters that declare fee-protocol support; check the optional fn first.
  3. Match the pool address to the correct adapter (PancakeSwap V3 adapter for PancakeSwap pools, not the Uniswap V3 adapter).
  4. If the event is irrelevant for the DEX, filter the topic0 out before dispatch and treat the log as ignorable rather than an error.

Example fix

// before
let ev = dex.parse_fee_protocol_update_event_rpc(&log)?; // bails for non-PancakeSwap dexes
// after
if let Some(ev) = dex
    .parse_fee_protocol_update_event_rpc(&log)
    .ok()
    .filter(|_| dex.parse_fee_protocol_update_event_rpc_fn.is_some())
{
    handle(ev);
}
Defensive patterns

Strategy: validation

Validate before calling

// dispatch SetFeeProtocol logs only to adapters that support them
if dex.parse_fee_protocol_update_event_rpc_fn.is_some()
    && log.topics.first().map(String::as_str) == Some(SET_FEE_PROTOCOL_TOPIC)
{
    let ev = dex.parse_fee_protocol_update_event_rpc(&log)?;
}

Type guard

fn supports_fee_protocol_update_rpc(dex: &DexExtended) -> bool {
    dex.parse_fee_protocol_update_event_rpc_fn.is_some()
}

Try / catch

match dex.parse_fee_protocol_update_event_rpc(&log) {
    Ok(ev) => handle(ev),
    Err(e) if e.to_string().contains("not defined in this dex") => {
        tracing::trace!("fee protocol update unsupported, skipping");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `dex.parse_fee_protocol_update_event_rpc(&log)` on a DEX such as a Uniswap V3 deployment (which has no SetFeeProtocol event) or a PancakeSwap V3 instance constructed without the fee-protocol RPC parser wired.

Common situations: Subscribing to SetFeeProtocol topic0 globally and dispatching every matching log to whichever DEX owns the pool address, including DEXes that don't support the event; using a Uniswap V3 adapter for a PancakeSwap V3 pool; partial adapter wiring on a newly added chain.

Related errors


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