{"record":{"id":"b5f9cdfac6fab5b9","repo":"nautechsystems/nautilus_trader","slug":"failed-to-record-prepared-execution-intent-e","errorCode":null,"errorMessage":"Failed to record prepared execution intent: {e}","messagePattern":"Failed to record prepared execution intent: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":3379,"sourceCode":"            anyhow::anyhow!(\n                \"Failed to reserve execution intent for signer {} on chain {}: {e}\",\n                intent.wallet_address,\n                intent.chain_id\n            )\n        })?;\n\n        sqlx::query(\n            \"\n            INSERT INTO execution_transaction_transition (\n                intent_id, transition_key, to_status, block_number\n            ) VALUES ($1, 'prepared', 'prepared', $2)\n            \",\n        )\n        .bind(row.id)\n        .bind(created_block)\n        .execute(&mut *transaction)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"Failed to record prepared execution intent: {e}\"))?;\n\n        transaction\n            .commit()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to commit execution intent reservation: {e}\"))?;\n        Ok(row)\n    }\n\n    /// Assigns the signer nonce to a prepared execution intent.\n    ///\n    /// Repeating the same assignment is idempotent. A different nonce or non-prepared state\n    /// fails closed.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the intent cannot own the nonce or persistence fails.\n    pub async fn assign_execution_intent_nonce(\n        &self,","sourceCodeStart":3361,"sourceCodeEnd":3397,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/2114cf6f761429e0adb5ca9596fcd7b895b16011/crates/adapters/blockchain/src/cache/database.rs#L3361-L3397","documentation":"Thrown when the INSERT of the 'prepared' row into execution_transaction_transition fails right after the intent INSERT succeeded inside reserve_execution_intent. The intent row exists only inside the uncommitted transaction, so this is nearly always a transport failure (dropped connection, statement timeout); the whole transaction rolls back and no intent is reserved.","triggerScenarios":"Connection drop between the intent INSERT and the transition INSERT; statement_timeout firing while the append-only trigger table is contended.","commonSituations":"Network blips during bursts of reservations; proxies closing sessions mid-transaction.","solutions":["Treat the reservation as not happened and re-reserve - the rollback left no orphan intent","Stabilize connectivity or raise statement_timeout if the error repeats","Check pg_stat_activity for lock contention on execution_transaction_transition"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match db.reserve_execution_intent(&intent).await {\n    Err(e) if e.to_string().contains(\"Failed to record prepared execution intent\") => {\n        // transaction rolled back: re-reserve from scratch\n    }\n    other => other?,\n}","preventionTips":["Treat any failure inside reserve_execution_intent as 'nothing reserved' - the transaction is atomic","Keep reservation transactions short so transport failures cannot split them","Monitor connection error rates on the pool used for reservations"],"tags":["rust","sqlx","postgresql","insert-failed","execution-intent","transaction"],"backgroundTag":"database-insert-failed","analyzedSha":"2114cf6f761429e0adb5ca9596fcd7b895b16011","analyzedAt":"2026-08-21T11:28:30.864Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}