Hmbown/CodeWhale · error · anyhow::Error

Thread is not loaded

Error message

Thread is not loaded

What it means

interrupt_turn looked the thread up in the active engines map and found no loaded engine. An engine that is not loaded has no running turn to interrupt, so the request is rejected before any turn-id matching.

Source

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

                Some(user_item),
                engine.clone(),
                ClaimedTurnKind::Message,
            )
        };

        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,

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Verify the thread id
  2. No interruption is needed if the thread is idle
Defensive patterns

Strategy: type-guard

When it happens

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