Hmbown/CodeWhale · error · anyhow::Error

No saved sessions found for workspace {}.

Error message

No saved sessions found for workspace {}.

What it means

fork_session(--last) asks SessionManager for the newest session recorded for the current workspace; when get_latest_session_for_workspace() returns None it bails with the workspace path. Sessions are tracked per workspace, so history recorded in another checkout does not help.

Source

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

}

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))
}

fn fork_session(
    config: &Config,
    session_id: Option<String>,
    last: bool,
    workspace: &Path,
) -> Result<String> {
    let manager = SessionManager::default_location()?;
    let saved = if last {
        let Some(meta) = manager.get_latest_session_for_workspace(workspace)? else {
            bail!(
                "No saved sessions found for workspace {}.",
                workspace.display()
            );
        };
        manager.load_session(&meta.id)?
    } else {
        let id = resolve_session_id(session_id, false, workspace)?;
        manager.load_session_by_prefix(&id)?
    };
    let saved_provider_identity = saved
        .metadata
        .model_provider_id
        .as_deref()
        .filter(|identity| !identity.trim().is_empty())
        .unwrap_or(&saved.metadata.model_provider);
    let provider_identity = config
        .resolve_persisted_provider_identity(
            Some(&saved.metadata.model_provider),

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Create history first: run a session in this workspace, then retry `fork --last`
  2. Or fork a specific known session by its id instead of --last
  3. Double-check you are in the workspace directory the sessions belong to

Example fix

// before
$ codewhale fork --last
Error: No saved sessions found for workspace /repo.

// after: make history once, then fork it
$ codewhale          # start a session in this workspace, exit
$ codewhale fork --last
// or: $ codewhale fork <session-id>
Defensive patterns

Strategy: validation

Validate before calling

let manager = SessionManager::default_location()?;
let latest = manager.get_latest_session_for_workspace(workspace)?;
if latest.is_none() { /* tell the user to create a session first */ }

Prevention

When it happens

Trigger: `codewhale fork --last` in a workspace where no session has ever been saved (or the store for this workspace is empty). The explicit-id path (resolve_session_id) has its own errors.

Common situations: Fresh clone or brand-new project directory; sessions live under a different workspace path; running the command from the wrong cwd.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/e986f43043a2dcb8. Report an issue: GitHub.