{"record":{"id":"b02c377ea8b2a33d","repo":"Hmbown/CodeWhale","slug":"no-active-turn-on-thread-thread-id","errorCode":null,"errorMessage":"No active turn on thread {thread_id}","messagePattern":"No active turn on thread (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":6191,"sourceCode":"            )\n        };\n\n        acceptance_rx\n            .await\n            .map_err(|_| anyhow!(\"Turn lifecycle task ended before acknowledgement\"))?\n            .map_err(anyhow::Error::msg)\n        })\n        .await\n    }\n\n    pub async fn interrupt_turn(&self, thread_id: &str, turn_id: &str) -> Result<TurnRecord> {\n        {\n            let mut active = self.active.lock().await;\n            let Some(active_thread) = active.engines.get_mut(thread_id) else {\n                bail!(\"Thread is not loaded\");\n            };\n            let Some(active_turn) = active_thread.active_turn.as_mut() else {\n                bail!(\"No active turn on thread {thread_id}\");\n            };\n            if active_turn.turn_id != turn_id {\n                bail!(\"Turn {turn_id} is not active on thread {thread_id}\");\n            }\n            active_turn.interrupt_requested = true;\n            if let Some(compaction_id) = active_turn.compaction_id.as_deref() {\n                active_thread.engine.cancel_compaction(compaction_id)?;\n            } else {\n                active_thread.engine.cancel();\n            }\n            touch_lru(&mut active.lru, thread_id);\n        }\n\n        self.emit_event(\n            thread_id,\n            Some(turn_id),\n            None,\n            \"turn.interrupt_requested\",","sourceCodeStart":6173,"sourceCodeEnd":6209,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/runtime_threads.rs#L6173-L6209","documentation":"Raised by interrupt_turn when the thread exists and is loaded but has no active_turn to interrupt. The active-turn map is inspected under lock; if the turn already completed, was cancelled, or never started, there is nothing to stop and the request fails with this error rather than returning a fabricated TurnRecord.","triggerScenarios":"Thrown at crates/tui/src/runtime_threads.rs:6191 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Nothing to interrupt — the turn likely already finished","Re-check thread state before retrying"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}