{"record":{"id":"bdd0a5820c112ed0","repo":"nautechsystems/nautilus_trader","slug":"failed-to-record-recoverable-transition-e","errorCode":null,"errorMessage":"Failed to record recoverable transition: {e}","messagePattern":"Failed to record recoverable transition: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":6553,"sourceCode":"        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to mark execution intent recoverable: {e}\"))?;\n        anyhow::ensure!(\n            result.rows_affected() == 1,\n            \"Execution intent {intent_id} is not recoverable from preparation\"\n        );\n        sqlx::query(\n            \"\n            INSERT INTO execution_transaction_transition (\n                intent_id, transition_key, from_status, to_status\n            ) VALUES ($1, 'recoverable', $2, 'recoverable')\n            ON CONFLICT (intent_id, transition_key) DO NOTHING\n            \",\n        )\n        .bind(intent_id)\n        .bind(current_status)\n        .execute(&mut *transaction)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to record recoverable transition: {e}\"))?;\n        transaction\n            .commit()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to commit recoverable transition: {e}\"))?;\n        Ok(())\n    }\n\n    /// Persists a signed transaction and advances its intent before broadcast.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the intent is not prepared, lacks a nonce, conflicts with a stored\n    /// hash, or persistence fails.\n    pub async fn add_execution_transaction_hash(\n        &self,\n        intent_id: i64,\n        chain_id: u32,\n        transaction_hash: &str,","sourceCodeStart":6535,"sourceCodeEnd":6571,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L6535-L6571","documentation":"After successfully flipping the intent to 'recoverable', the code inserts an audit row into execution_transaction_transition (transition_key 'recoverable'); if that INSERT fails, the error \"Failed to record recoverable transition: {e}\" is raised. The whole transaction then rolls back, so the intent remains 'prepared' — the failure is atomic.","triggerScenarios":"The INSERT INTO execution_transaction_transition fails: constraint violation (e.g. a foreign key or NOT NULL on from_status), schema mismatch after a migration, connection loss, or deadlock — anything that makes sqlx's execute return Err.","commonSituations":"A migration changed execution_transaction_transition (renamed columns, added a required column) while the adapter runs older expectations; database connection dropped after long transaction hold; permissions revoked on the transition table; disk-full or tablespace errors on the audit table.","solutions":["Read the wrapped sqlx error chain for the concrete constraint/message (e.g. column does not exist, foreign key violation).","Verify the execution_transaction_transition schema matches the adapter's expected columns (intent_id, transition_key, from_status, to_status).","Retry the operation after transient errors — the transaction rolled back atomically, so the intent stays 'prepared' and the transition is safe to redo.","Check grants on the transition table and database health (disk, connections) if the failure repeats."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Atomic rollback means safe retry after transient insert failures\nmatch db.mark_execution_intent_recoverable(id).await {\n    Err(e) if is_transient_db_error(&e) => retry_with_backoff(id),\n    Err(e) => return Err(e),\n    Ok(()) => {},\n}","preventionTips":["Keep the execution_transaction_transition schema in sync with adapter migrations.","Verify INSERT grants on the audit table for the adapter's DB role.","Retry transient errors — rollback leaves the intent 'prepared' and fully recoverable.","Monitor audit-table growth and disk usage to avoid insert failures at scale."],"tags":["database","insert","audit","sql"],"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-14T05:17:10.506Z"}