{"record":{"id":"01f1cbfcdec465ab","repo":"nautechsystems/nautilus_trader","slug":"replacement-transaction-unexpectedly-retains-si","errorCode":null,"errorMessage":"Replacement transaction {} unexpectedly retains signed bytes","messagePattern":"Replacement transaction (.+?) unexpectedly retains signed bytes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1209,"sourceCode":"        let mut authenticated_payloads = HashMap::new();\n        let mut current_payload = None;\n\n        for hash in &hashes {\n            anyhow::ensure!(\n                hash.intent_id == intent.id,\n                \"Persisted transaction row references intent {}, expected {}\",\n                hash.intent_id,\n                intent.id\n            );\n            anyhow::ensure!(\n                hash.chain_id == self.chain.chain_id,\n                \"Persisted transaction row chain ID {} does not match configured chain ID {}\",\n                hash.chain_id,\n                self.chain.chain_id\n            );\n\n            if !hash.payload_expected {\n                anyhow::ensure!(\n                    hash.raw_transaction.is_none() && hash.sealed_transaction.is_none(),\n                    \"Replacement transaction {} unexpectedly retains signed bytes\",\n                    hash.transaction_hash\n                );\n                continue;\n            }\n            let raw_transaction = open_execution_payload(\n                self.payload_keys\n                    .as_deref()\n                    .expect(\"payload keys checked above\"),\n                policy,\n                &intent,\n                hash,\n                \"recovery\",\n            )\n            .map_err(|e| {\n                anyhow::anyhow!(\n                    \"Execution intent {} signed transaction {} failed authentication: {e}\",","sourceCodeStart":1191,"sourceCodeEnd":1227,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L1191-L1227","documentation":"A transaction row flagged as a replacement (payload_expected == false) must not carry signed bytes; finding raw_transaction or sealed_transaction set means the persistence invariant is broken and rebroadcasting could conflict with a live replacement.","triggerScenarios":"connect() -> reconcile_unresolved_execution(): for a row where hash.payload_expected is false, either raw_transaction or sealed_transaction is Some.","commonSituations":"Partial/corrupted write during replacement flow; DB rows edited by tooling; version mismatch where older writers stored bytes for replacement rows.","solutions":["Null out raw_transaction/sealed_transaction on that replacement row after confirming it was never broadcast","Remove the inconsistent row and let recovery re-derive the replacement","Audit the replacement-signing code path to ensure it persists hashes without signed bytes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for h in hashes {\n    if !h.payload_expected && (h.raw_transaction.is_some() || h.sealed_transaction.is_some()) {\n        // clean the replacement row before recovery\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure replacement signing never persists signed bytes","Use DB constraints or post-write checks for the invariant","Avoid external writes to transaction rows"],"tags":["blockchain","database","invariant","replacement"],"backgroundTag":"internal-invariant-violation","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"}