{"record":{"id":"e4bcfe5a7fbb6010","repo":"nautechsystems/nautilus_trader","slug":"dex-does-not-have-initialize-event-set","errorCode":null,"errorMessage":"DEX {} does not have initialize event set.","messagePattern":"DEX (.+?) does not have initialize event set\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/data/core.rs","lineNumber":1715,"sourceCode":"    /// Returns an error if:\n    /// - Event streaming from HyperSync fails\n    /// - Event parsing or processing fails\n    /// - DEX configuration is invalid\n    async fn construct_pool_profiler_from_hypersync_rpc(\n        &mut self,\n        mut profiler: PoolProfiler,\n        from_position: Option<BlockPosition>,\n        to_block: u64,\n    ) -> anyhow::Result<(PoolProfiler, bool)> {\n        log::debug!(\"Constructing pool profiler from hypersync stream and RPC target block state\");\n        let dex_extended = self.get_dex_extended(&profiler.pool.dex.name)?.clone();\n        let mint_event_signature = dex_extended.mint_created_event.as_ref();\n        let burn_event_signature = dex_extended.burn_created_event.as_ref();\n        let initialize_event_signature =\n            if let Some(initialize_event) = &dex_extended.initialize_event {\n                initialize_event.as_ref()\n            } else {\n                anyhow::bail!(\n                    \"DEX {} does not have initialize event set.\",\n                    profiler.pool.dex.name\n                );\n            };\n        let mint_sig_bytes = hex::decode(\n            mint_event_signature\n                .strip_prefix(\"0x\")\n                .unwrap_or(mint_event_signature),\n        )?;\n        let burn_sig_bytes = hex::decode(\n            burn_event_signature\n                .strip_prefix(\"0x\")\n                .unwrap_or(burn_event_signature),\n        )?;\n        let initialize_sig_bytes = hex::decode(\n            initialize_event_signature\n                .strip_prefix(\"0x\")\n                .unwrap_or(initialize_event_signature),","sourceCodeStart":1697,"sourceCodeEnd":1733,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/data/core.rs#L1697-L1733","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set `initialize_event` (the hex event signature/topic0) on the DexExtended registry entry for this DEX name.","Verify the DEX actually has an Initialize event; if not, bootstrap this pool via the database/snapshot path instead of the HyperSync RPC path.","Check for typos in the DEX name used when registering the extended DEX config so the correct entry with `initialize_event` is looked up."],"exampleFix":"// before\nlet dex_extended = DexExtended { mint_created_event: Some(MINT_SIG), burn_created_event: Some(BURN_SIG), ..Default::default() };\n// after\nlet dex_extended = DexExtended { mint_created_event: Some(MINT_SIG), burn_created_event: Some(BURN_SIG), initialize_event: Some(INITIALIZE_SIG.to_string()), ..Default::default() };","handlingStrategy":"validation","validationCode":"// Rust: before bootstrapping via HyperSync RPC\nlet dex_extended = data.get_dex_extended(&pool.dex.name)?;\nanyhow::ensure!(\n    dex_extended.initialize_event.is_some(),\n    \"DEX {} is missing initialize_event; cannot bootstrap from RPC\",\n    pool.dex.name\n);","typeGuard":"fn has_initialize_event(dex: &DexExtended) -> bool {\n    dex.initialize_event.as_deref().map(|s| !s.is_empty()).unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Always populate initialize_event (and mint/burn signatures) when registering a new DexExtended.","Add a startup assertion validating all event-signature fields for every registered DEX.","Route DEXes without an Initialize event to non-RPC bootstrap paths."],"tags":["config","dex","missing-field","bootstrap"],"backgroundTag":"missing-required-config-field","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}