{"record":{"id":"a9295e08391d8928","repo":"nautechsystems/nautilus_trader","slug":"execution-intent-intent-id-has-no-current-hash","errorCode":null,"errorMessage":"Execution intent {intent_id} has no current hash","messagePattern":"Execution intent (.+?) has no current hash","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":3604,"sourceCode":"        .map(|duration| duration.as_secs())\n}\n\nfn validate_payload_operation_batch_size(batch_size: usize) -> anyhow::Result<i64> {\n    anyhow::ensure!(\n        (1..=MAX_PAYLOAD_OPERATION_BATCH_SIZE).contains(&batch_size),\n        \"Payload operation batch size must be between 1 and {MAX_PAYLOAD_OPERATION_BATCH_SIZE}\"\n    );\n    Ok(i64::try_from(batch_size).expect(\"bounded payload batch size fits i64\"))\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\nfn open_execution_payload(\n    keys: &PayloadKeySet,\n    policy: PayloadPolicy,\n    intent: &ExecutionIntentRow,\n    hash: &ExecutionTransactionHashRow,\n    reason: &str,\n) -> anyhow::Result<Vec<u8>> {\n    anyhow::ensure!(\n        hash.payload_expected,\n        \"Execution transaction {} has no signed payload\",\n        hash.transaction_hash","sourceCodeStart":3586,"sourceCodeEnd":3622,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L3586-L3622","documentation":"When resolving the active transaction hash for an execution intent, the client filters hash rows to those flagged `current` and requires exactly one. This error means no row is marked current, so there is no canonical hash to track the intent's on-chain transaction (after replacements there must always be one designated live hash).","triggerScenarios":"Looking up the current hash for `intent_id` when the hash table contains rows for the intent but none has `current = true` — e.g. a replacement transition that cleared the old current flag but failed to set the new one, or manual DB edits.","commonSituations":"Interrupted replacement flow (crash between flag updates); migration/backfill that dropped the current flags; concurrent writers racing on the current-flag update.","solutions":["Inspect `execution_transaction_hash` rows for the intent and check the `current` flags.","Repair by marking the latest/live hash row as current (single row) inside one transaction.","Re-run the replacement flow if state is ambiguous, or restore consistent ledger state from a known-good point."],"exampleFix":"// before: crash left no current row\nUPDATE execution_transaction_hash SET current = false WHERE intent_id = 42; -- crashed before next UPDATE\n// after: single transaction flips flags atomically\nBEGIN; UPDATE ... SET current=false ...; UPDATE ... SET current=true WHERE hash=$new; COMMIT;","handlingStrategy":"validation","validationCode":"let current_rows: Vec<_> = hashes.iter().filter(|r| r.current).collect();\nanyhow::ensure!(current_rows.len() == 1, \"intent {} has {} current hashes\", intent_id, current_rows.len());","typeGuard":null,"tryCatchPattern":"match select_current_hash_row(intent_id, &hashes) {\n    Err(e) if e.to_string().contains(\"has no current hash\") => repair_current_flag(intent_id).await,\n    other => other,\n}","preventionTips":["Update current-hash flags atomically in a single DB transaction","Add a DB constraint/trigger enforcing exactly one current row per intent","Reconcile current flags after crashes or migrations"],"tags":["database","state","transaction-hash","consistency"],"backgroundTag":"record-not-found","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}