nautechsystems/nautilus_trader · error

Execution intent {} was not found

Error message

Execution intent {} was not found

What it means

The locking SELECT on `execution_intent` returned no row for the given `assignment.intent_id`, so `.ok_or_else` produces this error. The library requires the intent to exist (and later be in `prepared`/active state) before it can atomically assign the canonical nonce; a nonexistent intent means the caller is referencing an intent ID that was never created or was deleted, and the assignment is aborted.

Source

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

        );

        let (intent_chain_id, intent_wallet, intent_nonce, intent_status, intent_active) =
            sqlx::query_as::<_, (i32, String, Option<i64>, String, bool)>(
                "
            SELECT chain_id, wallet_address, nonce, status, active
            FROM execution_intent
            WHERE id = $1
            FOR UPDATE
            ",
            )
            .bind(assignment.intent_id)
            .fetch_optional(&mut *transaction)
            .await
            .map_err(|e| {
                anyhow::anyhow!("Failed to lock execution intent for nonce assignment: {e}")
            })?
            .ok_or_else(|| {
                anyhow::anyhow!("Execution intent {} was not found", assignment.intent_id)
            })?;
        anyhow::ensure!(
            intent_chain_id == chain_id
                && intent_wallet == assignment.wallet_address
                && intent_status == "prepared"
                && intent_active
                && intent_nonce.is_none_or(|assigned| assigned == nonce),
            "Execution intent {} cannot own canonical nonce {}",
            assignment.intent_id,
            assignment.nonce
        );

        for (index, decision) in assignment.decisions.iter().enumerate() {
            let height_start = decision
                .height_start
                .map(i64::try_from)
                .transpose()
                .context("Verification height exceeds PostgreSQL BIGINT")?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Confirm the intent was created via the intent-preparation flow before calling assign, and that you are using the returned intent_id verbatim.
  2. Verify the application is connected to the same database/environment where the intent was created (check DATABASE_URL).
  3. Check whether a cleanup/retention job or migration deleted the row; re-create the intent and re-run assignment.
  4. Fetch the intent first (SELECT by id) as a pre-check and fail fast with a clearer application-level error if absent.
Defensive patterns

Strategy: validation

Validate before calling

let found = sqlx::query_scalar::<_, bool>("SELECT EXISTS(SELECT 1 FROM execution_intent WHERE id = $1)")
    .bind(&assignment.intent_id)
    .fetch_one(pool)
    .await?;
if !found { return Err(anyhow!("intent {} does not exist; create it before nonce assignment", assignment.intent_id)); }

Try / catch

if let Err(e) = db.assign_execution_intent_nonce_verified(&assignment).await {
    if e.to_string().ends_with("was not found") {
        // re-create the intent via the preparation flow before retrying
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: Calling `assign_execution_intent_nonce_verified` with an `ExecutionNonceAssignment` whose `intent_id` does not exist in the `execution_intent` table: a typo'd/stale ID, an intent created in a different database/environment, or an intent purged by retention/cleanup before assignment.

Common situations: Replaying a queued assignment after the intents table was truncated or migrated; pointing the app at a staging database while the intent exists in production; retrying a persisted assignment payload after the intent record was garbage-collected; mixing up intent IDs across chains.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/7a7ce44122ac3911. Report an issue: GitHub.