nautechsystems/nautilus_trader · error · anyhow::Error
Active finality intent was not found
Error message
Active finality intent was not found
What it means
Raised when the SELECT that locks the intent for verified finality returns no row for the given (intent_id, chain_id, wallet_address). The adapter requires an existing active intent row before it will apply a verified-finality transition, so a missing row aborts the finality commit. This is a lookup miss against the intents table, not a database failure.
Source
Thrown at crates/adapters/blockchain/src/cache/database.rs:7057
);
}
let (current_status, intent_nonce, fill_emitted, terminal_emitted) =
sqlx::query_as::<_, (String, Option<i64>, bool, bool)>(
"
SELECT status, nonce, fill_emitted, terminal_emitted
FROM execution_intent
WHERE id = $1 AND chain_id = $2 AND wallet_address = $3 AND active
FOR UPDATE
",
)
.bind(finality.intent_id)
.bind(chain_id)
.bind(finality.wallet_address)
.fetch_optional(&mut *transaction)
.await
.map_err(|e| anyhow::anyhow!("Failed to lock intent for verified finality: {e}"))?
.ok_or_else(|| anyhow::anyhow!("Active finality intent was not found"))?;
anyhow::ensure!(
intent_nonce == Some(nonce)
&& execution_transition_allowed(¤t_status, finality.status),
"Intent cannot make the verified finality transition"
);
for (index, decision) in finality.decisions.iter().enumerate() {
let height_start = decision
.height_start
.map(i64::try_from)
.transpose()
.context("Verification height exceeds PostgreSQL BIGINT")?;
let height_end = decision
.height_end
.map(i64::try_from)
.transpose()
.context("Verification height exceeds PostgreSQL BIGINT")?;
let transition_key = format!(View on GitHub (pinned to 18893faf8b)
Solutions
- Confirm the intent was actually created and committed before finality is applied (check event ordering/upstream producer)
- Query the intents table directly by intent_id to see whether the row exists and what its status/active flag is
- Verify chain_id and wallet_address are byte-identical to those used at intent creation (checksumming, casing, network)
- If intents are legitimately expired, skip or re-queue the finality event instead of retrying the same payload
Defensive patterns
Strategy: validation
Validate before calling
// Check the intent exists and is active before applying finality
let active = sqlx::query_scalar::<_, Option<i64>>(
"SELECT nonce FROM execution_intent \
WHERE intent_id = $1 AND chain_id = $2 AND wallet_address = $3 AND active"
)
.bind(&finality.intent_id).bind(chain_id).bind(finality.wallet_address)
.fetch_optional(&mut *conn).await?;
if active.is_none() {
// skip or requeue this finality event; do not attempt the transition
} Type guard
fn finality_has_known_intent(finality: &VerifiedFinality, known: &HashSet<String>) -> bool {
known.contains(&finality.intent_id)
} Try / catch
match apply_verified_finality(...).await {
Err(e) if e.to_string().contains("Active finality intent was not found") => {
warn!("finality for unknown intent {} — requeueing", finality.intent_id);
requeue(finality);
}
other => other,
} Prevention
- Enforce event ordering: intent creation must commit before its finality
- Normalize wallet_address and intent_id formats across services
- Reconcile finality events against known intents before applying
- Don't prune active intents while finality messages may still be in flight
When it happens
Trigger: Applying verified finality referencing an intent_id that was never recorded; the intent row was already closed/terminal and pruned or filtered out by the active-status WHERE clause; wallet_address or chain_id bound with different values than at intent creation.
Common situations: Replaying old finality events after intents were cleaned up; out-of-order message processing where finality arrives before the intent-creation write commits; environment mismatch (finality events from one DB applied against another); case/format differences in wallet_address between services.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Finality transaction hash was not found
- Failed to record verified finality intent: {e}
- Active verified-action intent was not found
- Execution transaction hash {transaction_hash} was not found
- Failed to persist finality verification: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/bbcc6ff07ad3a381.
Report an issue: GitHub.