nautechsystems/nautilus_trader · error · anyhow::Error
Failed to update execution intent
Error message
Failed to update execution intent {intent_id}: {e} What it means
Raised when the UPDATE of the execution_intent row itself (setting the new status and active flag) fails inside the transition transaction. Locking, validation, and the execution-hash update already succeeded, but this final status write errored, rolling back the entire transaction.
Solutions
- Read the inner `{e}` for the precise SQL error and fix the underlying cause (schema, constraint, connection).
- Retry the whole transition with backoff — the transaction rolled back cleanly, so state is consistent.
- Reduce lock hold time (shorten the transaction) to avoid connection drops under contention.
- Run pending migrations if the status column definition changed in a newer adapter version.
Example fix
// before
.map_err(|e| anyhow::anyhow!("Failed to update execution intent {intent_id}: {e}"))?;
// after
.map_err(|e| anyhow::anyhow!("Failed to update execution intent {intent_id} to {}: {e}", status.as_str()))?; Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: ensure status column accepts the value
sqlx::query("SELECT status FROM execution_intent LIMIT 1").execute(&pool).await?; Try / catch
match transition.await {
Err(e) if e.to_string().contains("Failed to update execution intent") => {
tracing::error!(error = %e, "intent update failed; transaction rolled back, safe to retry");
retry_with_backoff();
}
other => other?,
} Prevention
- Keep the transition transaction short to avoid session timeouts under lock contention.
- Apply schema migrations before the new adapter version writes new statuses.
- Monitor for connection drops during failover and alert on commit/update failures.
When it happens
Trigger: Calling the transition when the intent UPDATE statement errors: connection dropped mid-transaction, schema/constraint mismatch on status or active columns, deferred constraint violation from earlier statements, or statement timeout.
Common situations: Long-running transactions killed by idle_in_transaction_session_timeout while waiting on row locks under concurrency; migration drift changing the status column type/enum; database failover dropping the session mid-transaction.
Related errors
- Failed to update execution hash
- Failed to advance canonical nonce ledger
- Failed to commit execution transition
- Failed to commit verified action evidence
- Failed to commit verified finality transition
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/0b078a5c16d42d7a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/adapters/blockchain/src/cache/database.rs:6847
.map_err(|e| anyhow::anyhow!("Failed to update execution hash {transaction_hash}: {e}"))?;
anyhow::ensure!(
hash_result.rows_affected() == 1,
"Execution transaction hash {transaction_hash} was not found for intent {intent_id}"
);
sqlx::query(
"
UPDATE execution_intent
SET status = $2, active = $3, updated_at = NOW()
WHERE id = $1
",
)
.bind(intent_id)
.bind(status.as_str())
.bind(active)
.execute(&mut *transaction)
.await
.map_err(|e| anyhow::anyhow!("Failed to update execution intent {intent_id}: {e}"))?;
let transition_key = format!(
"{}:{transaction_hash}:{}:{}",
status.as_str(),
block_number.map_or_else(|| "none".to_string(), |value| value.to_string()),
block_hash.unwrap_or("none")
);
sqlx::query(
"
INSERT INTO execution_transaction_transition (
intent_id, transaction_hash_id, transition_key, from_status, to_status,
block_number, block_hash
)
SELECT $1, id, $3, $4, $5, $6, $7
FROM execution_transaction_hash
WHERE intent_id = $1 AND transaction_hash = $2
ON CONFLICT (intent_id, transition_key) DO NOTHING
",View on GitHub (pinned to 18893faf8b)