{"record":{"id":"f92785bd98d3a7a5","repo":"nautechsystems/nautilus_trader","slug":"failed-to-persist-verified-action-evidence-e","errorCode":null,"errorMessage":"Failed to persist verified action evidence: {e}","messagePattern":"Failed to persist verified action evidence: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/cache/database.rs","lineNumber":6163,"sourceCode":"                \",\n            )\n            .bind(batch.intent_id)\n            .bind(nonce)\n            .bind(batch.decision_class)\n            .bind(decision.read_class)\n            .bind(height_start)\n            .bind(height_end)\n            .bind(batch.manifest_version)\n            .bind(batch.manifest_digest)\n            .bind(batch.provider_ids)\n            .bind(batch.operator_ids)\n            .bind(batch.failure_domain_ids)\n            .bind(&decision.normalized_value_digest)\n            .bind(revision)\n            .bind(transition_key)\n            .execute(&mut *transaction)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to persist verified action evidence: {e}\"))?;\n        }\n        transaction\n            .commit()\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to commit verified action evidence: {e}\"))?;\n        Ok(())\n    }\n\n    pub(crate) async fn load_execution_replacement_cursor(\n        &self,\n        intent_id: i64,\n        chain_id: u32,\n        wallet_address: &str,\n        nonce: u64,\n        manifest_digest: &str,\n    ) -> anyhow::Result<Option<ExecutionVerifiedHeader>> {\n        let chain_id = i32::try_from(chain_id)\n            .context(\"Replacement scan chain ID exceeds PostgreSQL INTEGER\")?;","sourceCodeStart":6145,"sourceCodeEnd":6181,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/cache/database.rs#L6145-L6181","documentation":"The INSERT/UPDATE persisting a verified action-evidence batch into the database failed inside its transaction; the wrapped database error indicates the evidence record (intent, digest, heights, providers) could not be durably stored, aborting the persist step.","triggerScenarios":"An INSERT INTO execution_verification_decision fails for one decision: constraint violation (e.g. duplicate transition_key), value out of range for a column, type mismatch on arrays (provider_ids/operator_ids/failure_domain_ids), or connection loss.","commonSituations":"Duplicate transition_key collisions when the same decision_class: intent_id: read_class: attempt: index combination is inserted twice; array element type mismatch between the Rust slice and the Postgres column type; schema drift after a manifest/revision change.","solutions":["Read the inner `{e}` to identify the specific constraint or type error","Ensure the same (decision_class, intent_id, attempt) evidence is not inserted twice within one batch","Verify the Rust bind types match the Postgres column types (text[], i64, etc.)","Re-run migrations if the table schema is older than the code expects"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure no duplicate evidence rows for this attempt before inserting\nlet existing: i64 = sqlx::query_scalar(\n    \"SELECT COUNT(*) FROM execution_verification_decision WHERE intent_id=$1 AND decision_class=$2\",\n).bind(batch.intent_id).bind(batch.decision_class).fetch_one(&pool).await?;\nanyhow::ensure!(existing == 0, \"evidence already recorded for this attempt\");","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"duplicate key\") => {\n        // idempotent re-delivery of the same batch; treat as success or skip\n    }\n    Err(e) => return Err(e.into()),\n    Ok(_) => {}\n}","preventionTips":["Match Rust bind types to Postgres column types exactly (text[], bigint)","Make batch application idempotent via transition_key uniqueness","Run migrations whenever the manifest/schema changes","Log the full error chain to identify the failing constraint"],"tags":["database","insert","sqlx","postgres"],"backgroundTag":"database-write-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}