Hmbown/CodeWhale · error · anyhow::Error

No active turn on thread {thread_id}

Error message

No active turn on thread {thread_id}

What it means

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.

Source

Thrown at crates/tui/src/runtime_threads.rs:6191

            )
        };

        acceptance_rx
            .await
            .map_err(|_| anyhow!("Turn lifecycle task ended before acknowledgement"))?
            .map_err(anyhow::Error::msg)
        })
        .await
    }

    pub async fn interrupt_turn(&self, thread_id: &str, turn_id: &str) -> Result<TurnRecord> {
        {
            let mut active = self.active.lock().await;
            let Some(active_thread) = active.engines.get_mut(thread_id) else {
                bail!("Thread is not loaded");
            };
            let Some(active_turn) = active_thread.active_turn.as_mut() else {
                bail!("No active turn on thread {thread_id}");
            };
            if active_turn.turn_id != turn_id {
                bail!("Turn {turn_id} is not active on thread {thread_id}");
            }
            active_turn.interrupt_requested = true;
            if let Some(compaction_id) = active_turn.compaction_id.as_deref() {
                active_thread.engine.cancel_compaction(compaction_id)?;
            } else {
                active_thread.engine.cancel();
            }
            touch_lru(&mut active.lru, thread_id);
        }

        self.emit_event(
            thread_id,
            Some(turn_id),
            None,
            "turn.interrupt_requested",

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Nothing to interrupt — the turn likely already finished
  2. Re-check thread state before retrying
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/tui/src/runtime_threads.rs:6191 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/b02c377ea8b2a33d. Report an issue: GitHub.