nautechsystems/nautilus_trader · error · anyhow::Error
Failed to load execution transaction hashes: {e}
Error message
Failed to load execution transaction hashes: {e} What it means
This wraps any SQLx failure from loading all execution_transaction_hash rows for an intent in insertion order via fetch_all (database.rs:7348). The library throws it when the SELECT itself fails — connectivity, timeout, or schema problems — preventing the caller from enumerating an intent's transaction hashes.
Source
Thrown at crates/adapters/blockchain/src/cache/database.rs:7348
&self,
intent_id: i64,
) -> anyhow::Result<Vec<ExecutionTransactionHashRow>> {
sqlx::query_as::<_, ExecutionTransactionHashRow>(
"
SELECT
id, intent_id, chain_id, transaction_hash, payload_expected,
raw_transaction, sealed_transaction, status,
block_number, block_hash, receipt_success, gas_used,
effective_gas_price, current
FROM execution_transaction_hash
WHERE intent_id = $1
ORDER BY id
",
)
.bind(intent_id)
.fetch_all(&self.pool)
.await
.map_err(|e| anyhow::anyhow!("Failed to load execution transaction hashes: {e}"))
}
/// Marks one order event as emitted after dispatch.
///
/// # Errors
///
/// Returns an error if the event kind is unknown, the intent is absent, the opposing
/// terminal marker is already set, or persistence fails.
pub async fn mark_execution_event_emitted(
&self,
intent_id: i64,
event: &str,
) -> anyhow::Result<()> {
let statement = match event {
"acknowledgement" => {
"UPDATE execution_intent SET acknowledgement_emitted = TRUE, updated_at = NOW() WHERE id = $1"
}
"fill" => {View on GitHub (pinned to 18893faf8b)
Solutions
- Read the wrapped {e} to identify the driver-level cause.
- Retry on transient errors (connection reset, timeout); the query is read-only and idempotent.
- Apply pending migrations so execution_transaction_hash matches the expected schema.
- Check pool configuration and increase limits if the error correlates with concurrency.
- Verify DATABASE_URL and database reachability.
Example fix
// before: single attempt, hard failure
let hashes = db.load_intent_transaction_hashes(intent_id).await?;
// after: retry read-only query on transient errors
let hashes = retry(3, backoff, || async {
db.load_intent_transaction_hashes(intent_id).await
}).await.context("load execution transaction hashes")?; Defensive patterns
Strategy: retry
Validate before calling
let table_ok: bool = sqlx::query_scalar(
"SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'execution_transaction_hash')")
.fetch_one(&pool).await?;
anyhow::ensure!(table_ok, "execution_transaction_hash missing; run migrations"); Type guard
fn is_transient_read_error(e: &anyhow::Error) -> bool {
let s = e.to_string();
s.contains("connection") || s.contains("timed out") || s.contains("pool")
} Try / catch
let hashes = match load_result {
Err(e) if is_transient_read_error(&e) => retry_with_backoff(|| load_hashes(intent_id)).await?,
Err(e) => return Err(e),
Ok(h) => h,
}; Prevention
- Keep migrations synchronized across all environments.
- Size the connection pool for peak concurrency and monitor saturation.
- Set sane statement timeouts for read queries.
- Treat the read as idempotent and safe to retry.
When it happens
Trigger: The SELECT ... WHERE intent_id = $1 ORDER BY id fails: database connection dropped or pool exhausted, statement timeout, execution_transaction_hash table missing/altered by migration drift, or an oversized result exceeding memory/time limits.
Common situations: Adapter running against a database with unapplied migrations; transient network flakiness to Postgres; querying an intent_id whose rows were purged (returns empty list, not this error — this error is the query failing); load-related pool starvation.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Failed to load block timestamps: {e}
- Failed to number verified action evidence: {e}
- Failed to inspect recoverable signed executions: {e}
- Failed to load bars: {e}
- Failed to load signals: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/e87cb8934ca64294.
Report an issue: GitHub.