Hmbown/CodeWhale · error · anyhow::Error
Thread already has an active turn
Error message
Thread already has an active turn
What it means
start_turn's engine preflight found the thread already has an active turn. Threads execute one turn at a time; this fires when a second concurrent start (or a steering race) arrives before the first turn completes.
Source
Thrown at crates/tui/src/runtime_threads.rs:5933
req.permission_posture.as_deref(),
req.auto_approve,
)?
} else {
RuntimePolicyProjection::from_persisted(
&thread.mode,
thread.permission_posture.as_deref(),
thread.auto_approve,
)
};
let mode = policy.mode;
let engine = self.ensure_engine_loaded(&thread).await?;
let client_preflight_required = {
let active = self.active.lock().await;
if let Some(active_thread) = active.engines.get(thread_id)
&& active_thread.active_turn.is_some()
{
bail!("Thread already has an active turn");
}
active
.engines
.get(thread_id)
.is_none_or(|state| state.client_preflight_required)
};
// Resolve the concrete provider/model before persisting a turn. Auto
// routing can fail, and such a failure must not leave a zombie
// in-progress record behind.
let requested_model = req.model.as_deref().unwrap_or(&thread.model).to_string();
let auto_model = requested_model.trim().eq_ignore_ascii_case("auto");
let cfg_snapshot = self.config.read().clone();
let identity = self.provider_identity_for_thread(&cfg_snapshot, &thread)?;
let mut thread_config = cfg_snapshot.clone();
thread_config.scope_to_provider_identity(&identity);
let verbosity = thread_config.verbosity.clone();
let reasoning_preference = thread_configView on GitHub (pinned to 0c42157ee5)
Solutions
- Wait for the active turn to finish
- Or interrupt it before starting a new one
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/runtime_threads.rs:5933 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/c4981557be20dfd9.
Report an issue: GitHub.