nautechsystems/nautilus_trader · error

HyperSync parsing of swap event is not defined in this dex:

Error message

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

What it means

DexExtended::parse_swap_event_hypersync dispatches to the per-DEX HyperSync swap parser (parse_swap_event_hypersync_fn) and bails when no swap parser was defined for this DEX. The adapter cannot interpret swap logs via HyperSync for that DEX.

Source

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

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

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

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

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Skip swap logs for DEXes without a HyperSync swap parser instead of erroring
  2. Register the swap parser in the DEX adapter constructor if HyperSync swap support is intended
  3. Filter the HyperSync query topics to only include events for DEXes with parsers
  4. Route such DEXes through RPC-based event subscription

Example fix

// before
let swap = dex.parse_swap_event_hypersync(&log)?;
// after
match dex.swap_event_hypersync_support() {
    Some(_) => { let swap = dex.parse_swap_event_hypersync(&log)?; ... }
    None => tracing::debug!("swap hypersync parsing unsupported for {}", dex.dex.name),
}
Defensive patterns

Strategy: try-catch

Validate before calling

if dex.parse_swap_event_hypersync_fn.is_none() {
    tracing::debug!("no hypersync swap parser for {}", dex.dex.name);
    return Ok(()); // skip log
}

Type guard

fn has_hypersync_swap_parser(dex: &DexExtended) -> bool {
    dex.parse_swap_event_hypersync_fn.is_some()
}

Try / catch

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

Prevention

When it happens

Trigger: Calling parse_swap_event_hypersync (e.g. from send_dex_event_log while processing HyperSync logs) for a DEX constructed without a swap parser function.

Common situations: HyperSync subscription includes swap topics for DEXes that lack a HyperSync swap parser; adapter wiring forgot to set the swap parser; generic log-dispatch code calls all parsers without per-DEX capability checks.

Related errors


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