nautechsystems/nautilus_trader · error · anyhow::Error

Failed to record prepared execution intent: {e}

Error message

Failed to record prepared execution intent: {e}

What it means

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.

Source

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

            anyhow::anyhow!(
                "Failed to reserve execution intent for signer {} on chain {}: {e}",
                intent.wallet_address,
                intent.chain_id
            )
        })?;

        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,

View on GitHub (pinned to 2114cf6f76)

Solutions

  1. Treat the reservation as not happened and re-reserve - the rollback left no orphan intent
  2. Stabilize connectivity or raise statement_timeout if the error repeats
  3. Check pg_stat_activity for lock contention on execution_transaction_transition
Defensive patterns

Strategy: retry

Try / catch

match db.reserve_execution_intent(&intent).await {
    Err(e) if e.to_string().contains("Failed to record prepared execution intent") => {
        // transaction rolled back: re-reserve from scratch
    }
    other => other?,
}

Prevention

When it happens

Trigger: Connection drop between the intent INSERT and the transition INSERT; statement_timeout firing while the append-only trigger table is contended.

Common situations: Network blips during bursts of reservations; proxies closing sessions mid-transaction.

Related errors


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