{"record":{"id":"a5244b4699dbdf9a","repo":"Hmbown/CodeWhale","slug":"operation-key-binding-does-not-match-its-persisted-runtime","errorCode":null,"errorMessage":"operation_key binding does not match its persisted Runtime turn","messagePattern":"operation_key binding does not match its persisted Runtime turn","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":9072,"sourceCode":"            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,\n        operation_key: &str,\n    ) -> Result<Option<TurnRecord>, RuntimeTurnOperationLookupError> {\n        use RuntimeTurnOperationLookupError::{Incomplete, InvalidRequest, Unavailable};\n        validated_record_id(thread_id, \"thread id\").map_err(|_| InvalidRequest)?;\n        let fingerprint =\n            runtime_turn_operation_key_fingerprint(&self.store.owner_id, thread_id, operation_key)\n                .map_err(|_| InvalidRequest)?;\n        checked_existing_runtime_store_dir(&self.store.turn_operations_dir)","sourceCodeStart":9054,"sourceCodeEnd":9090,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L9054-L9090","documentation":"Consistency guard in the turn-operation binding check: the persisted binding's thread, fingerprints, and (when requested) turn id all match, but the turn record loaded from the store does not correspond to that persisted Runtime turn — the durable turn and its binding disagree.","triggerScenarios":"Thrown at crates/tui/src/runtime_threads.rs:9072 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the turn store and operation binding tables for divergence (crash mid-write) and repair the affected records.","Retry after Runtime recovery rebuilds consistent state."],"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"}