{"record":{"id":"e87cb8934ca64294","repo":"nautechsystems/nautilus_trader","slug":"failed-to-load-execution-transaction-hashes-e","errorCode":null,"errorMessage":"Failed to load execution transaction hashes: {e}","messagePattern":"Failed to load execution transaction hashes: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":7348,"sourceCode":"        &self,\n        intent_id: i64,\n    ) -> anyhow::Result<Vec<ExecutionTransactionHashRow>> {\n        sqlx::query_as::<_, ExecutionTransactionHashRow>(\n            \"\n            SELECT\n                id, intent_id, chain_id, transaction_hash, payload_expected,\n                raw_transaction, sealed_transaction, status,\n                block_number, block_hash, receipt_success, gas_used,\n                effective_gas_price, current\n            FROM execution_transaction_hash\n            WHERE intent_id = $1\n            ORDER BY id\n            \",\n        )\n        .bind(intent_id)\n        .fetch_all(&self.pool)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to load execution transaction hashes: {e}\"))\n    }\n\n    /// Marks one order event as emitted after dispatch.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the event kind is unknown, the intent is absent, the opposing\n    /// terminal marker is already set, or persistence fails.\n    pub async fn mark_execution_event_emitted(\n        &self,\n        intent_id: i64,\n        event: &str,\n    ) -> anyhow::Result<()> {\n        let statement = match event {\n            \"acknowledgement\" => {\n                \"UPDATE execution_intent SET acknowledgement_emitted = TRUE, updated_at = NOW() WHERE id = $1\"\n            }\n            \"fill\" => {","sourceCodeStart":7330,"sourceCodeEnd":7366,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L7330-L7366","documentation":"This wraps any SQLx failure from loading all execution_transaction_hash rows for an intent in insertion order via fetch_all (database.rs:7348). The library throws it when the SELECT itself fails — connectivity, timeout, or schema problems — preventing the caller from enumerating an intent's transaction hashes.","triggerScenarios":"The SELECT ... WHERE intent_id = $1 ORDER BY id fails: database connection dropped or pool exhausted, statement timeout, execution_transaction_hash table missing/altered by migration drift, or an oversized result exceeding memory/time limits.","commonSituations":"Adapter running against a database with unapplied migrations; transient network flakiness to Postgres; querying an intent_id whose rows were purged (returns empty list, not this error — this error is the query failing); load-related pool starvation.","solutions":["Read the wrapped {e} to identify the driver-level cause.","Retry on transient errors (connection reset, timeout); the query is read-only and idempotent.","Apply pending migrations so execution_transaction_hash matches the expected schema.","Check pool configuration and increase limits if the error correlates with concurrency.","Verify DATABASE_URL and database reachability."],"exampleFix":"// before: single attempt, hard failure\nlet hashes = db.load_intent_transaction_hashes(intent_id).await?;\n// after: retry read-only query on transient errors\nlet hashes = retry(3, backoff, || async {\n    db.load_intent_transaction_hashes(intent_id).await\n}).await.context(\"load execution transaction hashes\")?;","handlingStrategy":"retry","validationCode":"let table_ok: bool = sqlx::query_scalar(\n    \"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'execution_transaction_hash')\")\n    .fetch_one(&pool).await?;\nanyhow::ensure!(table_ok, \"execution_transaction_hash missing; run migrations\");","typeGuard":"fn is_transient_read_error(e: &anyhow::Error) -> bool {\n    let s = e.to_string();\n    s.contains(\"connection\") || s.contains(\"timed out\") || s.contains(\"pool\")\n}","tryCatchPattern":"let hashes = match load_result {\n    Err(e) if is_transient_read_error(&e) => retry_with_backoff(|| load_hashes(intent_id)).await?,\n    Err(e) => return Err(e),\n    Ok(h) => h,\n};","preventionTips":["Keep migrations synchronized across all environments.","Size the connection pool for peak concurrency and monitor saturation.","Set sane statement timeouts for read queries.","Treat the read as idempotent and safe to retry."],"tags":["database","sqlx","query"],"backgroundTag":"database-query-failed","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"}