{"record":{"id":"06a54ce34640f11f","repo":"nautechsystems/nautilus_trader","slug":"replacement-scan-conflicts-with-the-durable-finali","errorCode":null,"errorMessage":"Replacement scan conflicts with the durable finalized header ledger","messagePattern":"Replacement scan conflicts with the durable finalized header ledger","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":3143,"sourceCode":"            });\n        let candidate = candidates.next();\n        anyhow::ensure!(\n            candidates.next().is_none(),\n            \"Canonical replacement scan found duplicate signer-nonce transactions\"\n        );\n\n        let finalized_cursor = self\n            .database\n            .load_execution_verified_header(\n                self.chain_id,\n                &wallet_address,\n                end,\n                &self.manifest_digest,\n            )\n            .await?;\n\n        if let Some(cursor) = finalized_cursor.as_ref() {\n            anyhow::ensure!(\n                parse_verified_header(cursor)? == scanned_tip,\n                \"Replacement scan conflicts with the durable finalized header ledger\"\n            );\n        }\n\n        let mut mismatch = None;\n        let matched = candidate.and_then(|transaction| {\n            let Some(raw_transaction) = authenticated_payloads.get(&transaction.hash).cloned()\n            else {\n                mismatch = Some(anyhow::anyhow!(\n                    \"Canonical signer-nonce transaction {} has no authenticated retained payload\",\n                    transaction.hash\n                ));\n                return None;\n            };\n\n            if let Err(e) = validate_rpc_transaction_matches_payload(transaction, &raw_transaction)\n            {","sourceCodeStart":3125,"sourceCodeEnd":3161,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L3125-L3161","documentation":"After the replacement scan, the scanned tip must match the durable finalized header cursor stored in the database (if one exists for this intent/nonce/manifest). A mismatch means the in-memory scan result contradicts the persisted finalized ledger — the local scan and durable history have diverged.","triggerScenarios":"load_execution_replacement_cursor returned a finalized cursor whose parsed header differs from the scanned tip — e.g. the database cursor was written against a different chain/manifest, or a reorg invalidated previously finalized data while the DB retains the old header.","commonSituations":"Reusing a database across chain environments; reorg after the cursor was persisted; manually edited or migrated DB rows; pointing the client at a different RPC after the ledger was built.","solutions":["Confirm chain_id, wallet, and manifest_digest in the client config match those the ledger cursor was written with","Inspect the execution_replacement_cursor row and compare its header with the chain; reorg-aware repair or reset the cursor","Re-run reconciliation from an earlier block so the ledger is rebuilt consistently","Verify no out-of-band process mutates the ledger concurrently"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let cursor = db.load_execution_replacement_cursor(intent.id, chain_id, wallet, nonce, manifest_digest).await?;\nif let Some(cur) = cursor {\n    if parse_verified_header(&cur)? != scanned_tip {\n        return Err(\"ledger cursor and scan diverged; repair before proceeding\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep chain_id/manifest_digest consistent across restarts","Detect reorgs before trusting finalized cursors","Restrict DB writes to the client process","Cross-check cursor headers against the chain at startup"],"tags":["blockchain","database","consistency","ledger"],"backgroundTag":"checksum-mismatch","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"}