Hmbown/CodeWhale · error · anyhow::Error

mode must not be empty

Error message

mode must not be empty

What it means

Thread-update validation in runtime_threads: the request included a `mode` field whose value is empty after trimming. Optional fields are only assigned when present, so an explicitly blank mode is rejected instead of corrupting the thread's mode state.

Source

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

            && req.model.is_none()
            && req.mode.is_none()
            && req.permission_posture.is_none()
            && req.title.is_none()
            && req.system_prompt.is_none()
            && req.workspace.is_none()
        {
            bail!("At least one thread field is required");
        }

        if let Some(model) = req.model.as_ref()
            && model.trim().is_empty()
        {
            bail!("model must not be empty");
        }
        if let Some(mode) = req.mode.as_ref()
            && mode.trim().is_empty()
        {
            bail!("mode must not be empty");
        }
        if let Some(permission_posture) = req.permission_posture.as_ref()
            && permission_posture.trim().is_empty()
        {
            bail!("permission_posture must not be empty");
        }
        if let Some(workspace) = req.workspace.as_ref()
            && workspace.as_os_str().is_empty()
        {
            bail!("workspace must not be empty");
        }

        let configured_sandbox_mode = self.read_config().sandbox_mode.clone();
        let (thread, changes, evicted_engine, posture_engine) = {
            // Take the active guard first so a workspace mutation can check
            // and evict the cached engine atomically with the durable update.
            // Using the same order as start/compact avoids lock inversion.
            let mut active = self.active.lock().await;

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Omit the mode field entirely if unchanged
  2. Or pass a real mode value
Defensive patterns

Strategy: validation

When it happens

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