nautechsystems/nautilus_trader · error · anyhow::Error
Failed to record signed transaction transition: {e}
Error message
Failed to record signed transaction transition: {e} What it means
Recording the audit transition row in execution_transaction_transition (from the previous status to 'signed') failed with a database error. This is the idempotent history insert (ON CONFLICT DO NOTHING); the wrapped sqlx error indicates the append could not complete, rolling back the whole persistence transaction.
Source
Thrown at crates/adapters/blockchain/src/cache/database.rs:6735
.bind(intent_id)
.execute(&mut *transaction)
.await
.map_err(|e| anyhow::anyhow!("Failed to mark execution intent signed: {e}"))?;
sqlx::query(
"
INSERT INTO execution_transaction_transition (
intent_id, transaction_hash_id, transition_key, from_status, to_status
) VALUES ($1, $2, $3, $4, 'signed')
ON CONFLICT (intent_id, transition_key) DO NOTHING
",
)
.bind(intent_id)
.bind(row.id)
.bind(format!("signed:{transaction_hash}"))
.bind(current_status)
.execute(&mut *transaction)
.await
.map_err(|e| anyhow::anyhow!("Failed to record signed transaction transition: {e}"))?;
transaction
.commit()
.await
.map_err(|e| anyhow::anyhow!("Failed to commit signed transaction: {e}"))?;
Ok(row)
}
/// Records an idempotent transaction observation and advances its intent state.
///
/// # Errors
///
/// Returns an error if the transition is invalid, the hash is unknown, or persistence fails.
#[expect(
clippy::too_many_arguments,
reason = "the parameters are the canonical receipt observation persisted atomically"
)]
pub async fn record_execution_status(View on GitHub (pinned to 18893faf8b)
Solutions
- Read the inner {e}; if it mentions missing columns/relations, run the pending schema migrations for execution_transaction_transition.
- Retry the whole operation with backoff — the ON CONFLICT DO NOTHING makes the transition insert idempotent.
- Verify database connectivity and pool health if failures are transient.
- Confirm application and schema versions match (no partial migration) before restarting signing jobs.
Defensive patterns
Strategy: retry
Validate before calling
// ensure the audit table exists and matches expected schema before signing batches
sqlx::query("SELECT 1 FROM execution_transaction_transition LIMIT 1").fetch_optional(&pool).await?
.ok_or_else(|| anyhow::anyhow!("execution_transaction_transition missing or empty schema"))?; Try / catch
match db.add_execution_transaction(...).await {
Err(e) if e.to_string().contains("Failed to record signed transaction transition") => {
run_pending_migrations(&pool).await?; // schema drift case
retry(2, || db.add_execution_transaction(...)).await?;
}
r => r?,
} Prevention
- Run migrations as part of deployment before enabling signing workers
- Keep application and schema versions in lockstep
- Rely on ON CONFLICT DO NOTHING idempotency when retrying
- Alert on transition-insert failures — they indicate schema or connectivity drift
When it happens
Trigger: The INSERT into execution_transaction_transition errored: connection failure, statement timeout, schema mismatch (missing columns/changed constraints after a partial migration), or a FK violation if the hash row id became invalid mid-transaction.
Common situations: Database schema drift where the transition table was altered or not migrated; transient connectivity loss late in the transaction; heavy contention on the transition table under bulk signing.
Related errors
- Failed to record recoverable transition: {e}
- Failed to persist signed transaction {transaction_hash}: {e}
- Error executing statement {sql_statement} with error: {e:?}
- Failed to activate execution schema version 2: {e}
- Failed to install verification schema: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/46ae4958484bbef4.
Report an issue: GitHub.