Hmbown/CodeWhale · error · anyhow::Error

No saved sessions found for workspace {}. Use `codewhale ses

Error message

No saved sessions found for workspace {}. Use `codewhale sessions` to list all sessions, or `codewhale resume <SESSION_ID>` to resume one explicitly.

What it means

Bailed in resolve_session_id when --last was requested but the workspace's session store contained no saved sessions, so there is nothing to implicitly resume.

Source

Thrown at crates/tui/src/lib.rs:7808

    println!("Cleared saved API key.");
    Ok(())
}

async fn run_xai_device_auth(config_path: Option<&Path>) -> Result<()> {
    let pending = xai_oauth::device_code_login().await?;
    let activation = xai_oauth::activate_device_login(pending, config_path, None)?;
    println!(
        "xAI OAuth is ready; activated {} via {}",
        codewhale_config::quote_os_path(&activation.auth_path),
        codewhale_config::quote_os_path(&activation.config_path)
    );
    Ok(())
}

fn resolve_session_id(session_id: Option<String>, last: bool, workspace: &Path) -> Result<String> {
    if last {
        return latest_session_id_for_workspace(workspace)?.ok_or_else(|| {
            anyhow!(
                "No saved sessions found for workspace {}. Use `codewhale sessions` to list all sessions, or `codewhale resume <SESSION_ID>` to resume one explicitly.",
                workspace.display()
            )
        });
    }
    if let Some(id) = session_id {
        return Ok(id);
    }
    pick_session_id()
}

fn latest_session_id_for_workspace(workspace: &Path) -> std::io::Result<Option<String>> {
    let manager = SessionManager::default_location()?;
    Ok(manager
        .get_latest_session_for_workspace(workspace)?
        .map(|session| session.id))
}

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Run `codewhale sessions` to list sessions across all workspaces
  2. Resume explicitly with `codewhale resume <SESSION_ID>`
  3. Start a new session in this workspace to create a saveable history
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/lib.rs:7808 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/ebbba32bcfb709ec. Report an issue: GitHub.