nautechsystems/nautilus_trader · error · anyhow::Error

Failed to commit execution intent reservation: {e}

Error message

Failed to commit execution intent reservation: {e}

What it means

Thrown when COMMIT fails at the end of reserve_execution_intent, after both the intent row and its 'prepared' transition row were inserted. The transaction rolls back, so the signer slot and client_order_id are NOT reserved - the error means ownership was not acquired and nothing was signed on top of it.

Source

Thrown at crates/adapters/blockchain/src/cache/database.rs:3384

        })?;

        sqlx::query(
            "
            INSERT INTO execution_transaction_transition (
                intent_id, transition_key, to_status, block_number
            ) VALUES ($1, 'prepared', 'prepared', $2)
            ",
        )
        .bind(row.id)
        .bind(created_block)
        .execute(&mut *transaction)
        .await
        .map_err(|e| anyhow::anyhow!("Failed to record prepared execution intent: {e}"))?;

        transaction
            .commit()
            .await
            .map_err(|e| anyhow::anyhow!("Failed to commit execution intent reservation: {e}"))?;
        Ok(row)
    }

    /// Assigns the signer nonce to a prepared execution intent.
    ///
    /// Repeating the same assignment is idempotent. A different nonce or non-prepared state
    /// fails closed.
    ///
    /// # Errors
    ///
    /// Returns an error if the intent cannot own the nonce or persistence fails.
    pub async fn assign_execution_intent_nonce(
        &self,
        intent_id: i64,
        nonce: u64,
    ) -> anyhow::Result<()> {
        let nonce_db = i64::try_from(nonce)
            .with_context(|| format!("Execution nonce {nonce} exceeds PostgreSQL BIGINT"))?;

View on GitHub (pinned to 2114cf6f76)

Solutions

  1. Re-run the reservation - the failed commit means the slot is still free
  2. Raise idle_in_transaction_session_timeout on the server
  3. Check Postgres logs for the commit-time failure cause if it recurs
Defensive patterns

Strategy: retry

Try / catch

match db.reserve_execution_intent(&intent).await {
    Err(e) if e.to_string().contains("Failed to commit execution intent reservation") => {
        // commit failed and rolled back: safe to re-reserve the same client_order_id
    }
    other => other?,
}

Prevention

When it happens

Trigger: Connection reset at commit time; Postgres failover between the inserts and COMMIT; idle_in_transaction_session_timeout firing on a slow path.

Common situations: Unstable managed-database links; long pauses (GC, tracing) delaying commit past server timeouts.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@2114cf6f76 (2026-08-21). Data as JSON: /api/errors/7504cbfdb63e39e3. Report an issue: GitHub.