{"record":{"id":"940b209b3ae938c1","repo":"nautechsystems/nautilus_trader","slug":"failed-to-start-execution-intent-reservation-e","errorCode":null,"errorMessage":"Failed to start execution intent reservation: {e}","messagePattern":"Failed to start execution intent reservation: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":3324,"sourceCode":"    ///\n    /// # Errors\n    ///\n    /// Returns an error if the signer or client order is already owned, or persistence fails.\n    pub async fn reserve_execution_intent(\n        &self,\n        intent: &ExecutionIntentInsert,\n    ) -> anyhow::Result<ExecutionIntentRow> {\n        let chain_id = i32::try_from(intent.chain_id)\n            .with_context(|| format!(\"Chain ID {} exceeds PostgreSQL INTEGER\", intent.chain_id))?;\n        let created_block = i64::try_from(intent.created_block).with_context(|| {\n            format!(\n                \"Execution creation block {} exceeds PostgreSQL BIGINT\",\n                intent.created_block\n            )\n        })?;\n        let mut transaction =\n            self.pool.begin().await.map_err(|e| {\n                anyhow::anyhow!(\"Failed to start execution intent reservation: {e}\")\n            })?;\n        let row = sqlx::query_as::<_, ExecutionIntentRow>(\n            \"\n            INSERT INTO execution_intent (\n                schema_version, chain_id, wallet_address, purpose, status,\n                client_order_id, trader_id, strategy_id, account_id, instrument_id,\n                pool_address, transaction_to, transaction_input, transaction_value,\n                amount_in, created_block\n            )\n            VALUES ($1, $2, $3, $4, 'prepared', $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15)\n            RETURNING\n                id, schema_version, chain_id, wallet_address, nonce, purpose, status,\n                client_order_id, trader_id, strategy_id, account_id, instrument_id,\n                pool_address, transaction_to, transaction_input, transaction_value,\n                amount_in, created_block, acknowledgement_emitted, fill_emitted,\n                terminal_emitted, active\n            \",\n        )","sourceCodeStart":3306,"sourceCodeEnd":3342,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/2114cf6f761429e0adb5ca9596fcd7b895b16011/crates/adapters/blockchain/src/cache/database.rs#L3306-L3342","documentation":"Thrown when reserve_execution_intent fails at pool.begin(), before the intent INSERT runs. As with other begin failures, the wrapped sqlx error means a connection could not be acquired: database unreachable, pool exhausted by concurrent activity, or a dropped connection. No signer slot or client order is touched when this fires.","triggerScenarios":"Reserving intents while the pool is fully checked out by receipt recorders; database restart mid-trading; acquire_timeout shorter than load spikes allow.","commonSituations":"Trade bursts exhaust pool capacity; a connection leak elsewhere; failover of the database tier.","solutions":["Verify database health (SELECT 1) and network connectivity","Increase pool max_connections and acquire_timeout to cover peak concurrency","Bound concurrent reservations with a semaphore so begin() never starves","Retry only after transient connection failures - a successful reserve is exactly-once ownership, not an idempotent write"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Cheap liveness probe before attempting a reservation under load\nlet ok = sqlx::query(\"SELECT 1\").execute(&pool).await.is_ok();","typeGuard":null,"tryCatchPattern":"match db.reserve_execution_intent(&intent).await {\n    Err(e) if e.downcast_ref::<sqlx::Error>() == Some(&sqlx::Error::PoolTimedOut) => {\n        // shed load or expand the pool, then retry; nothing was reserved\n    }\n    other => other?,\n}","preventionTips":["Bound concurrent reservations with a semaphore sized below pool capacity","Tune max_connections and acquire_timeout for peak trade bursts","Reserve before building/signing the transaction so a begin() failure costs nothing"],"tags":["rust","sqlx","postgresql","connection-pool","execution-intent"],"backgroundTag":"database-connection-failed","analyzedSha":"2114cf6f761429e0adb5ca9596fcd7b895b16011","analyzedAt":"2026-08-21T11:28:30.864Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}