{"record":{"id":"15165e25dcb460e2","repo":"nautechsystems/nautilus_trader","slug":"failed-to-mark-execution-intent-signed-e","errorCode":null,"errorMessage":"Failed to mark execution intent signed: {e}","messagePattern":"Failed to mark execution intent signed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":6720,"sourceCode":"        .bind(sealed_transaction)\n        .fetch_optional(&mut *transaction)\n        .await\n        .map_err(|e| {\n            anyhow::anyhow!(\"Failed to persist signed transaction {transaction_hash}: {e}\")\n        })?\n        .ok_or_else(|| {\n            anyhow::anyhow!(\n                \"Signed transaction {transaction_hash} conflicts with its persisted identity\"\n            )\n        })?;\n\n        sqlx::query(\n            \"UPDATE execution_intent SET status = 'signed', updated_at = NOW() WHERE id = $1\",\n        )\n        .bind(intent_id)\n        .execute(&mut *transaction)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to mark execution intent signed: {e}\"))?;\n        sqlx::query(\n            \"\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()","sourceCodeStart":6702,"sourceCodeEnd":6738,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L6702-L6738","documentation":"After the signed transaction row was persisted, the status advance (UPDATE execution_intent SET status = 'signed') failed with a database error. The library wraps the sqlx error; the enclosing transaction rolls back so the signed-transaction insert is not left committed without its status transition.","triggerScenarios":"The UPDATE statement errored: connection loss, statement timeout, deadlock with another transaction touching the execution_intent row, or writes being routed to a read-only replica.","commonSituations":"DB failover or pool invalidation mid-transaction; very large signed payload slowing the transaction past statement_timeout; concurrent maintenance blocking the update.","solutions":["Retry the whole add_execution_transaction call with backoff — it is idempotent and transactional, so a full retry is safe.","Check the inner {e} to distinguish connectivity vs timeout vs constraint causes and address accordingly.","Verify the pool points at the primary, not a read replica, and that statement_timeout is adequate.","Reduce transaction duration to avoid mid-transaction failures."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify connectivity/primary before long signing transactions\nlet role: String = sqlx::query_scalar(\"SELECT CASE WHEN pg_is_in_recovery() THEN 'replica' ELSE 'primary' END\").fetch_one(&pool).await?;\nanyhow::ensure!(role == \"primary\", \"writes require the primary database\");","typeGuard":null,"tryCatchPattern":"retry(3, backoff(200).factor(2.0), || async {\n    db.add_execution_transaction(intent_id, chain_id, hash, sealed).await\n}).await?; // transactional + idempotent, safe to retry whole flow","preventionTips":["Point write pools at the primary, never a replica","Size statement_timeout to cover the full persistence transaction","Retry the entire operation on transient commit-path errors","Monitor connection pool health and failover events"],"tags":["database","sql","state-machine","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"}