{"record":{"id":"a6f290b6d5295e84","repo":"nautechsystems/nautilus_trader","slug":"failed-to-start-verified-action-evidence-e","errorCode":null,"errorMessage":"Failed to start verified action evidence: {e}","messagePattern":"Failed to start verified action evidence: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":6066,"sourceCode":"        anyhow::ensure!(\n            !batch.decision_class.trim().is_empty() && !batch.decisions.is_empty(),\n            \"Verified action requires a decision class and evidence\"\n        );\n        anyhow::ensure!(\n            batch.provider_ids.len() == 3\n                && batch.operator_ids.len() == 3\n                && batch.failure_domain_ids.len() >= 3,\n            \"Verified action requires the configured provider identities\"\n        );\n        let chain_id = i32::try_from(batch.chain_id)\n            .context(\"Verification chain ID exceeds PostgreSQL INTEGER\")?;\n        let nonce =\n            i64::try_from(batch.nonce).context(\"Execution nonce exceeds PostgreSQL BIGINT\")?;\n        let mut transaction = self\n            .pool\n            .begin()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to start verified action evidence: {e}\"))?;\n        let (manifest_version, manifest_digest, revision) =\n            sqlx::query_as::<_, (String, String, i64)>(\n                \"\n                SELECT manifest_version, manifest_digest, revision\n                FROM execution_verification_nonce\n                WHERE chain_id = $1 AND wallet_address = $2\n                FOR SHARE\n                \",\n            )\n            .bind(chain_id)\n            .bind(batch.wallet_address)\n            .fetch_optional(&mut *transaction)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to read verified action nonce ledger: {e}\"))?\n            .ok_or_else(|| anyhow::anyhow!(\"Canonical nonce ledger is not initialized\"))?;\n        anyhow::ensure!(\n            manifest_version == batch.manifest_version && manifest_digest == batch.manifest_digest,\n            \"Verified action manifest identity changed\"","sourceCodeStart":6048,"sourceCodeEnd":6084,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L6048-L6084","documentation":"Thrown when opening the PostgreSQL transaction for recording verified-action evidence fails at the pool.begin() step. The database could not start a transaction, so no ledger read or writes occur and the whole operation aborts with this anyhow error.","triggerScenarios":"self.pool.begin() returns Err — pool exhausted, database unreachable, connection broken, or the database is starting up/shutting down.","commonSituations":"Postgres restart or failover; connection pool max_size exhausted under load; network partition to the database; wrong DSN/credentials after a config change so all connections fail.","solutions":["Verify database connectivity and credentials, then retry the operation.","Increase the sqlx pool size or add acquire_timeout headroom if the pool is saturated.","Check Postgres logs and health (pg_isready) for restarts or failures at the error timestamp.","Retry with backoff; beginning a transaction is safe to retry since no work was done."],"exampleFix":"// before\nrecord_execution_verification_batch(&db, &batch).await?;\n// after: ensure the pool is healthy first\nsqlx::query(\"SELECT 1\").execute(&db).await.context(\"database unavailable\")?;\nrecord_execution_verification_batch(&db, &batch).await?;","handlingStrategy":"retry","validationCode":"// Rust: health-check the pool before the operation\nsqlx::query(\"SELECT 1\").execute(&db).await\n    .context(\"database unavailable before verified action\")?;","typeGuard":null,"tryCatchPattern":"// Rust\nmatch record_batch().await {\n    Err(e) if e.to_string().contains(\"Failed to start verified action evidence\") => {\n        wait_for_db_ready(&db).await?;\n        record_batch().await.map_err(Into::into)\n    }\n    res => res.map_err(Into::into),\n}","preventionTips":["Monitor pool utilization and raise max_size under load.","Add connection health checks and reasonable acquire_timeout.","Alert on database restarts/failovers."],"tags":["database","transaction","connection","rust"],"backgroundTag":"database-query-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}