Hmbown/CodeWhale · error
Failed to trigger compaction: engine operation channel close
Error message
Failed to trigger compaction: engine operation channel closed
What it means
Raised when submitting a CompactContext op: the send on the engine operation channel returned Err because the receiving engine task has closed the channel (engine dropped or shut down). It fires before the compaction turn is ever executed — the freshly built compaction turn record and route are durable but no worker will process them.
Source
Thrown at crates/tui/src/runtime_threads.rs:6417
effective_dispatched_at: None,
effective_model: Some(crate::cost_status::sanitize_persisted_route_label(
&route_model,
)),
routed_usage: Vec::new(),
routed_usage_source_ids: Vec::new(),
routed_usage_dropped_records: 0,
error: None,
item_ids: Vec::new(),
steer_count: 0,
agent_mail_message_id: None,
};
let op = Op::CompactContext {
id: compaction_id.clone(),
route: Box::new(route),
compaction: Box::new(compaction),
};
let permit = engine.tx_op.clone().reserve_owned().await.map_err(|_| {
anyhow!("Failed to trigger compaction: engine operation channel closed")
})?;
let acceptance_rx = {
let mut active = self.active.lock().await;
let Some(state) = active.engines.get_mut(thread_id) else {
bail!("Thread engine not loaded");
};
if state.active_turn.is_some() {
bail!("Thread already has an active turn");
}
let _thread_mutation = self.store.thread_mutation.lock();
let mut current_thread = self.store.load_thread(thread_id)?;
if !thread_execution_state_matches(&thread, ¤t_thread) {
bail!("Thread execution settings changed while preparing compaction; retry");
}
let previous_active_route = (state.route_identity.clone(), state.route_model.clone());
state.active_turn = Some(ActiveTurnState {
turn_id: turn_id.clone(),View on GitHub (pinned to 0c42157ee5)
Solutions
- Verify the engine task for this thread is still running and was not torn down
- Restart the engine/session and re-trigger compaction
- Check logs for an engine panic or explicit shutdown that closed the op channel
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/tui/src/runtime_threads.rs:6417 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/636e29ece4c5c450.
Report an issue: GitHub.