{"record":{"id":"104413de47807483","repo":"nautechsystems/nautilus_trader","slug":"failed-to-get-pool-event-family-checkpoints-e","errorCode":null,"errorMessage":"Failed to get pool event-family checkpoints: {e}","messagePattern":"Failed to get pool event-family checkpoints: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":1596,"sourceCode":"            return Ok(PoolEventSyncState::default());\n        };\n\n        let family_blocks = sqlx::query_as::<_, (String, i64)>(\n            \"\n            SELECT event_family, last_full_sync_block_number\n            FROM pool_event_sync\n            WHERE chain_id = $1\n            AND dex_name = $2\n            AND pool_identifier = $3\n            ORDER BY event_family\n            \",\n        )\n        .bind(chain_id as i32)\n        .bind(dex.to_string())\n        .bind(pool_identifier.as_ref())\n        .fetch_all(&self.pool)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to get pool event-family checkpoints: {e}\"))?\n        .into_iter()\n        .map(|(family, block)| (family, block as u64))\n        .collect();\n\n        Ok(PoolEventSyncState {\n            version: version as u32,\n            last_full_sync_block: last_full_sync_block.map(|block| block as u64),\n            family_blocks,\n        })\n    }\n\n    pub(crate) async fn update_pool_event_sync(\n        &self,\n        chain_id: u32,\n        dex: &DexType,\n        pool_identifier: &PoolIdentifier,\n        event_families: &[&str],\n        block_number: u64,","sourceCodeStart":1578,"sourceCodeEnd":1614,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L1578-L1614","documentation":"Wraps a sqlx error from the SELECT listing per-event-family checkpoint blocks for a pool. These checkpoints track independent event family progress (e.g. swaps vs mints). Failure aborts reconstruction of the pool's event sync state.","triggerScenarios":"Calling the event-family checkpoint query inside `get_pool_event_sync_state` when the connection fails, the checkpoint table is missing, or the server errors (timeout/cancellation).","commonSituations":"Missing migrations on a new deployment; DB restart; long-running query cancelled by statement_timeout.","solutions":["Apply migrations to create the event-family checkpoint table","Check statement_timeout settings if the query is cancelled on large pools","Verify connectivity and retry","Inspect the wrapped sqlx error for the root cause"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"sqlx::query(\"SELECT 1 FROM pool_event_family_checkpoints LIMIT 1\").fetch_optional(&pool).await?;","typeGuard":null,"tryCatchPattern":"let checkpoints = loop {\n    match get_family_checkpoints(...).await {\n        Ok(c) => break c,\n        Err(e) if attempts < 3 => { attempts += 1; sleep(backoff).await; }\n        Err(e) => return Err(e),\n    }\n};","preventionTips":["Create checkpoint tables via migrations","Set realistic statement_timeout for large pools","Retry idempotent reads with backoff"],"tags":["database","sqlx","read-failure","event-sync"],"backgroundTag":"sql-query-failed","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"}