nautechsystems/nautilus_trader · error

HyperSync parsing of initialize event is not defined in this

Error message

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

What it means

Raised by parse_initialize_event_hypersync when the DEX has no HyperSync parser registered for pool-initialize events (parse_initialize_event_hypersync_fn is None). The initialize event signals new pool creation; without a registered parser the adapter cannot decode the log and bails with chain:name. This is a declared-capability gap rather than a data error.

Source

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

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

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

    /// Parses a collect event from a HyperSync log.
    ///
    /// # Errors
    ///
    /// Returns an error if the DEX does not have a HyperSync collect event parser defined or if parsing fails.
    pub fn parse_collect_event_hypersync(
        &self,
        log: &HypersyncLog,
    ) -> anyhow::Result<CollectEvent> {
        if let Some(parse_fn) = &self.parse_collect_event_hypersync_fn {
            parse_fn(self.dex.clone(), log)

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Register parse_initialize_event_hypersync_fn for this DEX at construction time.
  2. Exclude the initialize topic from this DEX's HyperSync subscription/query filters so the parse path is never hit.
  3. Verify the log actually belongs to this DEX's factory contract before parsing.
  4. Handle the capability gap explicitly by checking parser presence and skipping unsupported events.
Defensive patterns

Strategy: try-catch

Validate before calling

if !dex_supports(dex, DexEvent::InitializeHypersync) { skip_log(); }

Type guard

fn has_hypersync_initialize_parser(dex: &Dex) -> bool { dex.parse_initialize_event_hypersync_fn.is_some() }

Try / catch

match dex.parse_initialize_event_hypersync(&log) {
    Ok(evt) => handle_new_pool(evt),
    Err(e) if e.to_string().contains("not defined in this dex") => tracing::debug!("initialize not supported for this dex"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling dex.parse_initialize_event_hypersync(&log) on a DEX constructed without an initialize-event HyperSync parser, e.g. a DEX type that does not track pool creation or whose factory events are unsupported over HyperSync.

Common situations: Subscribing a DEX to factory/initialize topic streams it cannot decode; forgetting to wire the initialize parser in a new DEX definition; running multi-DEX discovery where one DEX lacks pool-creation support; DEX forks registered from a generic template without event coverage.

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/505308dfd8dcf070. Report an issue: GitHub.