{"record":{"id":"9e37baf587af2f66","repo":"nautechsystems/nautilus_trader","slug":"failed-to-load-from-execution-transaction-table","errorCode":null,"errorMessage":"Failed to load from execution_transaction table: {e}","messagePattern":"Failed to load from execution_transaction table: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":7465,"sourceCode":"                    wallet_address,\n                    nonce,\n                    transaction_hash,\n                    purpose,\n                    status,\n                    client_order_id,\n                    1 AS source_priority\n                FROM execution_transaction\n                WHERE chain_id = $1 AND transaction_hash = $2\n            ) AS record\n            ORDER BY source_priority\n            LIMIT 1\n        \",\n        )\n        .bind(chain_id_db)\n        .bind(transaction_hash)\n        .fetch_optional(&self.pool)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to load from execution_transaction table: {e}\"))\n    }\n}\n\nfn execution_payload_state_from_row(\n    row: &sqlx::postgres::PgRow,\n) -> anyhow::Result<ExecutionPayloadState> {\n    Ok(ExecutionPayloadState {\n        deployment_id: row.try_get(\"deployment_id\")?,\n        protocol_version: row.try_get(\"protocol_version\")?,\n        operation: row.try_get(\"operation\")?,\n        active_key_id: row.try_get(\"active_key_id\")?,\n    })\n}\n\nfn validate_execution_payload_state(\n    state: &ExecutionPayloadState,\n    keys: &PayloadKeySet,\n) -> anyhow::Result<()> {","sourceCodeStart":7447,"sourceCodeEnd":7483,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L7447-L7483","documentation":"This error wraps any SQLx failure that occurs while fetching a row from the `execution_transaction` table via `fetch_optional`. The database lookup itself failed (as opposed to simply returning no row), so the error carries the underlying SQLx/Postgres message. It signals a broken query rather than a missing record.","triggerScenarios":"Calling the execution_transaction load method when the database is unreachable, the table does not exist, credentials are wrong, the connection pool is exhausted, or the query type mismatch (e.g. a binary/hash column with wrong bind type) causes a Postgres error.","commonSituations":"Postgres restarted or network drop mid-operation; migrations not applied so execution_transaction table is missing; wrong DATABASE_URL pointing to a schema without the table; pool timeout under load.","solutions":["Read the wrapped SQLx error message to identify the concrete DB failure (connection, missing table, timeout)","Run pending database migrations to ensure execution_transaction exists","Check database connectivity and that DATABASE_URL points to the correct instance","Inspect pool configuration; increase pool size/timeout if errors appear under load"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"sqlx::query(\"SELECT 1 FROM execution_transaction LIMIT 1\").fetch_optional(&pool).await.map_err(|e| format!(\"db unreachable: {e}\"))?;","typeGuard":null,"tryCatchPattern":"match load_execution_transaction(&pool, chain_id, &hash).await {\n    Ok(Some(state)) => handle(state),\n    Ok(None) => handle_missing(),\n    Err(e) if is_transient_db_error(&e) => schedule_retry(e),\n    Err(e) => return Err(e),\n}","preventionTips":["Run migrations at startup so the table always exists","Add connection-pool health checks and retry with backoff for transient Postgres errors","Validate DATABASE_URL and credentials in a startup health check"],"tags":["database","rust","sqlx","postgres"],"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-14T00:17:10.932Z"}