{"record":{"id":"f9c48c297b1cd7b1","repo":"nautechsystems/nautilus_trader","slug":"pool-tick-spacing-must-be-set","errorCode":null,"errorMessage":"Pool tick spacing must be set","messagePattern":"Pool tick spacing must be set","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/model/src/defi/pool_analysis/profiler.rs","lineNumber":108,"sourceCode":"    /// The event timestamp of the last processed event.\n    pub last_processed_ts: Option<UnixNanos>,\n    /// Flag indicating whether the pool has been initialized with a starting price.\n    pub is_initialized: bool,\n    /// Optional progress reporter for tracking event processing.\n    reporter: Option<BlockchainSyncReporter>,\n    /// The last block number that was reported (used for progress tracking).\n    last_reported_block: u64,\n}\n\nimpl PoolProfiler {\n    /// Creates a new [`PoolProfiler`] instance for tracking pool state and events.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the pool's tick spacing is not set.\n    #[must_use]\n    pub fn new(pool: SharedPool) -> Self {\n        let tick_spacing = pool.tick_spacing.expect(\"Pool tick spacing must be set\");\n        let mut state = PoolState::default();\n\n        if let Some((fee_protocol0, fee_protocol1)) =\n            initial_protocol_fee_basis_points(pool.dex.name, pool.fee)\n        {\n            state.set_protocol_fee_basis_points(fee_protocol0, fee_protocol1);\n        }\n\n        Self {\n            pool,\n            positions: AHashMap::new(),\n            tick_map: TickMap::new(tick_spacing),\n            state,\n            analytics: PoolAnalytics::default(),\n            last_processed_event: None,\n            last_processed_ts: None,\n            is_initialized: false,\n            reporter: None,","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/model/src/defi/pool_analysis/profiler.rs#L90-L126","documentation":"PoolProfiler::new() requires the SharedPool to have tick_spacing set, since the profiler's PoolState and tick map construction depend on it. The library panics via expect when pool.tick_spacing is None, i.e. the pool was never initialized with its Uniswap-V3-style tick spacing.","triggerScenarios":"Constructing a PoolProfiler with PoolProfiler::new(pool) where pool.tick_spacing is None — e.g. a SharedPool created from incomplete topology data (factory event without tickSpacing, or a pool stub built before fetching on-chain tick spacing).","commonSituations":"Running pool analysis on a pool whose topology discovery step failed or was skipped; building SharedPool structs by hand for tests without setting tick_spacing; version changes where tick_spacing became optional.","solutions":["Populate pool.tick_spacing (e.g. from the factory's tickSpacing() call or the PoolCreated event) before constructing the profiler.","Guard with if pool.tick_spacing.is_none() { /* fetch topology */ } before calling PoolProfiler::new.","Reject/fail the pool earlier in ingestion so uninitialized pools never reach the profiler."],"exampleFix":"// before\nlet profiler = PoolProfiler::new(pool);\n// after\nassert!(pool.tick_spacing.is_some(), \"Pool {} tick spacing missing; fetch topology first\", pool.address);\nlet profiler = PoolProfiler::new(pool);","handlingStrategy":"validation","validationCode":"if pool.tick_spacing.is_none() { return Err(anyhow::anyhow!(\"pool tick spacing not set\")); }","typeGuard":"fn is_pool_initialized(pool: &SharedPool) -> bool { pool.tick_spacing.is_some() && pool.fee.is_some() }","tryCatchPattern":"let profiler = if is_pool_initialized(&pool) { Some(PoolProfiler::new(pool)) } else { None };","preventionTips":["Fetch tickSpacing during pool topology discovery before any analysis.","Centralize a completeness check (fee + tick_spacing) for SharedPool construction.","Reject uninitialized pools at ingestion rather than at use."],"tags":["rust","panic","defi","uniswap-v3","initialization"],"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-14T00:17:10.932Z"}