{"record":{"id":"13cb2463e93aa9c2","repo":"nautechsystems/nautilus_trader","slug":"failed-to-commit-signed-transaction-e","errorCode":null,"errorMessage":"Failed to commit signed transaction: {e}","messagePattern":"Failed to commit signed transaction: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":6740,"sourceCode":"            \"\n            INSERT INTO execution_transaction_transition (\n                intent_id, transaction_hash_id, transition_key, from_status, to_status\n            ) VALUES ($1, $2, $3, $4, 'signed')\n            ON CONFLICT (intent_id, transition_key) DO NOTHING\n            \",\n        )\n        .bind(intent_id)\n        .bind(row.id)\n        .bind(format!(\"signed:{transaction_hash}\"))\n        .bind(current_status)\n        .execute(&mut *transaction)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to record signed transaction transition: {e}\"))?;\n\n        transaction\n            .commit()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to commit signed transaction: {e}\"))?;\n        Ok(row)\n    }\n\n    /// Records an idempotent transaction observation and advances its intent state.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the transition is invalid, the hash is unknown, or persistence fails.\n    #[expect(\n        clippy::too_many_arguments,\n        reason = \"the parameters are the canonical receipt observation persisted atomically\"\n    )]\n    pub async fn record_execution_status(\n        &self,\n        intent_id: i64,\n        transaction_hash: &str,\n        status: TransactionStatus,\n        block_number: Option<u64>,","sourceCodeStart":6722,"sourceCodeEnd":6758,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L6722-L6758","documentation":"The final COMMIT of the persistence transaction failed. All prior work (payload state checks, intent lock, signed row insert, status update, transition record) is rolled back, so the operation can be retried safely, but nothing was persisted. The library wraps the commit error with context.","triggerScenarios":"transaction.commit() errored: connection dropped between the last statement and COMMIT (network blip, pool idle timeout, DB failover), server-side commit failure, or the transaction already aborted server-side due to a timeout.","commonSituations":"PostgreSQL restart/failover mid-transaction; load balancer terminating long-idle connections; very large sealed payloads extending transaction duration past network idle limits; infrastructure churn during deployments.","solutions":["Retry the entire add_execution_transaction call — transactionality guarantees no partial state, and retries are idempotent (ON CONFLICT guards).","Harden connectivity: keepalives, reasonable pool idle timeouts, and statement_timeout sized to the transaction's work.","Check for failover events in the database logs around the failure time.","Split heavy work out of the DB transaction where possible to shorten the commit window."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight: confirm a trivial transaction can commit before batch signing\nlet mut tx = pool.begin().await?;\ntx.commit().await.context(\"database cannot commit; aborting signing batch\")?;","typeGuard":null,"tryCatchPattern":"let result = retry(3, backoff(250).jitter(), || async {\n    db.add_execution_transaction(intent_id, chain_id, hash, sealed).await\n}).await;\nif let Err(e) = result { error!(%e, \"commit failed after retries; verify no partial state — operation is transactional\"); }","preventionTips":["Enable TCP keepalives and sane idle timeouts on the pool to survive long transactions","Retry whole operations after commit failures — transactionality prevents partial writes","Watch for DB failovers and pause signing during maintenance windows","Keep the transaction body small so the commit window stays short"],"tags":["database","transaction","commit","postgresql"],"backgroundTag":"database-write-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"}