nautechsystems/nautilus_trader · error

DEX {} does not have initialize event set.

Error message

DEX {} does not have initialize event set.

What it means

During RPC/HyperSync bootstrap of a pool profiler, the code reads the DEX's configured `initialize_event` topic signature from the extended DEX registry. If that optional field is None, it cannot subscribe to or recognize the pool's Initialize event, so bootstrap fails closed with this bail instead of silently producing an uninitialized profiler.

Source

Thrown at crates/adapters/blockchain/src/data/core.rs:1715

    /// Returns an error if:
    /// - Event streaming from HyperSync fails
    /// - Event parsing or processing fails
    /// - DEX configuration is invalid
    async fn construct_pool_profiler_from_hypersync_rpc(
        &mut self,
        mut profiler: PoolProfiler,
        from_position: Option<BlockPosition>,
        to_block: u64,
    ) -> anyhow::Result<(PoolProfiler, bool)> {
        log::debug!("Constructing pool profiler from hypersync stream and RPC target block state");
        let dex_extended = self.get_dex_extended(&profiler.pool.dex.name)?.clone();
        let mint_event_signature = dex_extended.mint_created_event.as_ref();
        let burn_event_signature = dex_extended.burn_created_event.as_ref();
        let initialize_event_signature =
            if let Some(initialize_event) = &dex_extended.initialize_event {
                initialize_event.as_ref()
            } else {
                anyhow::bail!(
                    "DEX {} does not have initialize event set.",
                    profiler.pool.dex.name
                );
            };
        let mint_sig_bytes = hex::decode(
            mint_event_signature
                .strip_prefix("0x")
                .unwrap_or(mint_event_signature),
        )?;
        let burn_sig_bytes = hex::decode(
            burn_event_signature
                .strip_prefix("0x")
                .unwrap_or(burn_event_signature),
        )?;
        let initialize_sig_bytes = hex::decode(
            initialize_event_signature
                .strip_prefix("0x")
                .unwrap_or(initialize_event_signature),

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set `initialize_event` (the hex event signature/topic0) on the DexExtended registry entry for this DEX name.
  2. Verify the DEX actually has an Initialize event; if not, bootstrap this pool via the database/snapshot path instead of the HyperSync RPC path.
  3. Check for typos in the DEX name used when registering the extended DEX config so the correct entry with `initialize_event` is looked up.

Example fix

// before
let dex_extended = DexExtended { mint_created_event: Some(MINT_SIG), burn_created_event: Some(BURN_SIG), ..Default::default() };
// after
let dex_extended = DexExtended { mint_created_event: Some(MINT_SIG), burn_created_event: Some(BURN_SIG), initialize_event: Some(INITIALIZE_SIG.to_string()), ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

// Rust: before bootstrapping via HyperSync RPC
let dex_extended = data.get_dex_extended(&pool.dex.name)?;
anyhow::ensure!(
    dex_extended.initialize_event.is_some(),
    "DEX {} is missing initialize_event; cannot bootstrap from RPC",
    pool.dex.name
);

Type guard

fn has_initialize_event(dex: &DexExtended) -> bool {
    dex.initialize_event.as_deref().map(|s| !s.is_empty()).unwrap_or(false)
}

Prevention

When it happens

Trigger: Calling bootstrap_latest_pool_profiler, bootstrap_pool_profiler_from_rpc_snapshot, or advance_pool_profiler_from_rpc_snapshot for a DEX whose registry entry (DexExtended) has `initialize_event` unset — i.e. any non-univ3-style DEX or an incompletely registered DEX routed through construct_pool_profiler_from_hypersync_rpc.

Common situations: Adding a new DEX adapter but forgetting to set `initialize_event` in its DexExtended config; using a DEX (e.g. an AMM without a Uniswap-V3-style Initialize event) that lacks on-chain snapshot support; a config/registry version change dropping the field.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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