{"record":{"id":"364a3f0f8ea5d1eb","repo":"Hmbown/CodeWhale","slug":"failed-to-steer-turn-error","errorCode":null,"errorMessage":"Failed to steer turn: {error}","messagePattern":"Failed to steer turn: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":10412,"sourceCode":"                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                if active_turn.interrupt_requested {\n                    bail!(\"Turn {turn_id} is stopping and cannot be steered\");\n                }\n                active_thread.engine.clone()\n            };\n            touch_lru(&mut active.lru, thread_id);\n            engine\n        };\n\n        let permit = engine\n            .reserve_steer()\n            .await\n            .map_err(|error| anyhow!(\"Failed to steer turn: {error}\"))?;\n\n        let now = Utc::now();\n        let queued_turn;\n        let item = TurnItemRecord {\n            schema_version: CURRENT_RUNTIME_SCHEMA_VERSION,\n            id: format!(\"item_{}\", &Uuid::new_v4().to_string()[..8]),\n            turn_id: turn_id.to_string(),\n            kind: TurnItemKind::UserMessage,\n            // Queued, not Completed: the text is in the engine's mailbox, not\n            // yet in the turn's record. `spawn_steer_settlement` flips it once\n            // the engine reports what actually happened (#6276).\n            status: TurnItemLifecycleStatus::Queued,\n            summary: summarize_text(&prompt, SUMMARY_LIMIT),\n            detail: Some(prompt.clone()),\n            metadata: None,\n            artifact_refs: Vec::new(),\n            started_at: Some(now),\n            ended_at: None,","sourceCodeStart":10394,"sourceCodeEnd":10430,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L10394-L10430","documentation":"Raised when `engine.reserve_steer()` fails while attempting to steer (inject a mid-turn user message into) an active turn. The engine's steer mailbox could not reserve a slot — typically because the turn is no longer accepting steers (finishing/stopping) or the engine's operation channel is saturated or closed. The underlying engine error is interpolated into the message.","triggerScenarios":"Calling the steer API (`steer_turn`) on a running turn when `reserve_steer()` returns Err — e.g. the active turn just reached its terminal phase, an interrupt was requested concurrently, or the engine op channel is closed/full.","commonSituations":"User sends a steer message at the same moment the model finishes its turn; steering a turn that another window just interrupted; racing an engine reload (the channel changed between locks).","solutions":["Retry the steer; if the turn truly finished, send a normal new message instead.","Check whether the turn was interrupted or completed concurrently (`Turn is stopping and cannot be steered` guards run first).","If the engine channel is closed, reload the thread (ensure the engine is re-spawned) and retry."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = runtime.steer_turn(&thread_id, &turn_id, text).await {\n    // fall back to sending a new message on the thread\n}","preventionTips":["Steer early in the turn rather than right as it finishes.","Check turn status before steering; do not steer interrupted/stopping turns.","Avoid steering while a config reload or engine swap is in progress.","Treat a steer failure as a signal to check whether the turn already completed."],"tags":["steering","concurrency","async","rust"],"backgroundTag":"invalid-state-transition","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"}