{"record":{"id":"675525b1499ddfbd","repo":"Hmbown/CodeWhale","slug":"operation-key-is-already-bound-to-a-different-turn-request","errorCode":null,"errorMessage":"operation_key is already bound to a different turn request","messagePattern":"operation_key is already bound to a different turn request","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":9064,"sourceCode":"        &self,\n        prepared: &PreparedRuntimeTurnOperation,\n    ) -> Result<Option<TurnRecord>> {\n        let requested = &prepared.binding;\n        let Some(persisted) = self\n            .store\n            .load_turn_operation_binding(&requested.operation_key_fingerprint)?\n        else {\n            return Ok(None);\n        };\n        if persisted.thread_id != requested.thread_id\n            || persisted.operation_key_fingerprint != requested.operation_key_fingerprint\n            || persisted.request_fingerprint != requested.request_fingerprint\n            || prepared\n                .requested_turn_id\n                .as_deref()\n                .is_some_and(|turn_id| persisted.turn_id != turn_id)\n        {\n            bail!(\"operation_key is already bound to a different turn request\");\n        }\n        let turn_path = self.store.turn_path(&persisted.turn_id)?;\n        if !turn_path.exists() {\n            bail!(\"operation_key binding is incomplete; retry after Runtime recovery\");\n        }\n        let turn = self.store.load_turn(&persisted.turn_id)?;\n        if turn.id != persisted.turn_id || turn.thread_id != persisted.thread_id {\n            bail!(\"operation_key binding does not match its persisted Runtime turn\");\n        }\n        Ok(Some(turn))\n    }\n\n    /// Read the exact durable binding without replaying, recovering, loading an\n    /// engine, or creating even a claim-lock file. The shared claim prevents a\n    /// reader from observing admission records that can still be rolled back.\n    pub(crate) fn lookup_turn_operation(\n        &self,\n        thread_id: &str,","sourceCodeStart":9046,"sourceCodeEnd":9082,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L9046-L9082","documentation":"Turn operation idempotency check: the operation_key's stored binding (thread, key fingerprint, request fingerprint, or requested turn) differs from the incoming request — the same key is being replayed with different content, which would silently alias two different turns.","triggerScenarios":"Thrown at crates/tui/src/runtime_threads.rs:9064 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a distinct operation_key for the new turn request, or reuse the exact original request for a replay.","Treat the persisted turn as the authoritative result of the earlier operation key."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}