nautechsystems/nautilus_trader · error

HyperSync parsing of CollectProtocol event is not defined in

Error message

HyperSync parsing of CollectProtocol event is not defined in this dex: {}:{}

What it means

Raised by parse_fee_protocol_collect_event_hypersync when the DEX lacks a HyperSync parser for the CollectProtocol event (parse_fee_protocol_collect_event_hypersync_fn is None). CollectProtocol logs protocol-fee collection by the factory owner/treasury; adapters that do not track protocol fee collection bail with chain:name instead of guessing a decode.

Source

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

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

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

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

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Register the CollectProtocol HyperSync parser for the DEX if protocol-fee collection is in scope.
  2. Filter CollectProtocol topics out of queries for DEXs without support.
  3. Route the log to the DEX adapter that actually owns the emitting contract.
  4. Gracefully skip the event when parser support is absent.
Defensive patterns

Strategy: try-catch

Validate before calling

if !dex_supports(dex, DexEvent::CollectProtocolHypersync) { return Ok(()); }

Type guard

fn has_fee_protocol_collect_parser(dex: &Dex) -> bool { dex.parse_fee_protocol_collect_event_hypersync_fn.is_some() }

Try / catch

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

Prevention

When it happens

Trigger: Calling dex.parse_fee_protocol_collect_event_hypersync(&log), e.g. dispatched from send_dex_event_log while indexing treasury revenue logs, on a DEX without this parser registered.

Common situations: Indexing protocol revenue across many DEXs where some lack support; fork DEXs with different treasury event names/signatures; new DEX integration that only wired swap/mint/burn parsers.

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/2991f625a51c4eae. Report an issue: GitHub.