nautechsystems/nautilus_trader · error

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

Error message

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

What it means

Raised by parse_swap_event_rpc when the DEX has no RPC swap-event parser registered (parse_swap_event_rpc_fn is None). Swap events are the most common DEX event, so hitting this means the DEX adapter was deliberately or accidentally constructed without RPC swap decoding, and the call bails with chain:name.

Source

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

        } else {
            anyhow::bail!(
                "RPC parsing of pool created event is not defined in this dex: {}:{}",
                self.dex.chain,
                self.dex.name,
            )
        }
    }

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

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

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Register parse_swap_event_rpc_fn for the DEX when RPC ingestion is needed.
  2. Use the DEX's HyperSync swap parser instead if RPC parsing is not supported.
  3. Ensure the log's emitting contract belongs to this DEX before parsing.
  4. Check parser presence before subscribing this DEX to RPC swap topics.
Defensive patterns

Strategy: try-catch

Validate before calling

if !dex_supports(dex, DexEvent::SwapRpc) { return Ok(()); } // don't subscribe this dex to RPC swap topics

Type guard

fn has_rpc_swap_parser(dex: &Dex) -> bool { dex.parse_swap_event_rpc_fn.is_some() }

Try / catch

match dex.parse_swap_event_rpc(&log) {
    Ok(evt) => handle_swap(evt),
    Err(e) if e.to_string().contains("not defined in this dex") => tracing::debug!("RPC swap parsing unsupported on {}", dex.name()),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling dex.parse_swap_event_rpc(&log) on RPC log streams (eth_subscribe/eth_getLogs) for a DEX built without an RPC swap parser — e.g. a DEX intended for HyperSync-only ingestion.

Common situations: Switching a pipeline from HyperSync to RPC transport without adding RPC parsers; new DEX registration with only HyperSync fns wired; forks whose Swap signature differs and were left unimplemented on the RPC side.

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/00c47b34edbdf889. Report an issue: GitHub.