{"record":{"id":"97fcb86a539ef9e2","repo":"nautechsystems/nautilus_trader","slug":"execution-intent-intent-id-has-more-than-one-cur","errorCode":null,"errorMessage":"Execution intent {intent_id} has more than one current hash","messagePattern":"Execution intent (.+?) has more than one current hash","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":1833,"sourceCode":"            \"Canonical head changed during signer-nonce replacement scan\"\n        );\n        Ok(found)\n    }\n\n    fn release_slot(&self) {\n        *self.in_flight.lock().expect(\"in-flight mutex poisoned\") = None;\n    }\n}\n\nfn current_execution_hash(\n    intent_id: i64,\n    hashes: &[ExecutionTransactionHashRow],\n) -> anyhow::Result<&ExecutionTransactionHashRow> {\n    let mut current = hashes.iter().filter(|row| row.current);\n    let row = current\n        .next()\n        .ok_or_else(|| anyhow::anyhow!(\"Execution intent {intent_id} has no current hash\"))?;\n    anyhow::ensure!(\n        current.next().is_none(),\n        \"Execution intent {intent_id} has more than one current hash\"\n    );\n    Ok(row)\n}\n\n/// Polls for the receipt of a broadcast transaction until it exists or the poll bound\n/// is exhausted. A `null` receipt result is a legitimate pending response.\n#[cfg(test)]\nasync fn poll_for_receipt(\n    http_rpc_client: &BlockchainHttpRpcClient,\n    tx_hash: &B256,\n    max_polls: u32,\n    interval: Duration,\n) -> anyhow::Result<Option<RpcTransactionReceipt>> {\n    let mut last_error = None;\n    let mut observed_pending = false;\n","sourceCodeStart":1815,"sourceCodeEnd":1851,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/2114cf6f761429e0adb5ca9596fcd7b895b16011/crates/adapters/blockchain/src/execution/client.rs#L1815-L1851","documentation":"current_execution_hash() found two or more rows with current = TRUE among an intent's transaction hashes, violating the single-current invariant maintained through replace operations (a replacement tx supersedes the previous one). With multiple candidates the reconciler cannot decide which hash to track, so it refuses rather than guessing.","triggerScenarios":"Reconciliation loading an intent whose execution_transaction_hash rows contain several current = TRUE entries: concurrent writers racing on the flag update, a failed transaction around the supersede step, or manual SQL leaving extra rows flagged.","commonSituations":"Two client instances sharing one database/wallet (unsupported); crash between clearing the old flag and committing the new one wrapped in separate transactions; hand-run UPDATE statements during incident recovery.","solutions":["List the duplicates: SELECT id, transaction_hash, status, current FROM execution_transaction_hash WHERE intent_id = <id> AND current ORDER BY id;","Verify on-chain which transaction is canonical (latest with the intent's nonce) and set current = FALSE on the others","Ensure only one NautilusTrader client instance per wallet+database runs at a time","Re-run reconciliation after the repair"],"exampleFix":"-- before: two rows flagged current\n-- id=101 current=t, id=105 current=t\n\n-- after: keep only the on-chain-confirmed latest hash as current\nUPDATE execution_transaction_hash\nSET current = (id = 105)\nWHERE intent_id = 42;","handlingStrategy":"try-catch","validationCode":"-- Detect duplicate current flags before they block reconciliation\nSELECT intent_id, count(*) AS current_rows\nFROM execution_transaction_hash\nWHERE current\nGROUP BY intent_id\nHAVING count(*) > 1;\n-- Expect zero rows on a healthy store.","typeGuard":null,"tryCatchPattern":"try:\n    client.connect()\nexcept Exception as e:\n    if 'more than one current hash' in str(e):\n        # verify which tx is canonical on-chain (intent nonce), keep only that row current,\n        # set current = FALSE on the others, then reconnect\n        ...\n    raise","preventionTips":["Run exactly one execution client per wallet + database; concurrent writers corrupt the current flag","Include the duplicate-current-hash check in routine DB health checks"],"tags":["blockchain","postgres","data-integrity","transaction-hash","reconciliation"],"backgroundTag":"data-integrity-violation","analyzedSha":"2114cf6f761429e0adb5ca9596fcd7b895b16011","analyzedAt":"2026-08-21T11:28:30.864Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}