aaif-goose/goose · error · anyhow::Error

No session found to resume

Error message

No session found to resume

What it means

anyhow error from the CLI's session bootstrap (crates/goose-cli/src/cli.rs) when --resume is passed with no name/id/path identifier and SessionManager::list_sessions_by_types(&[SessionType::User]) returns an empty list. With no identifier, goose defaults to 'most recent user session', and there is none.

Source

Thrown at crates/goose-cli/src/cli.rs:414

    resume: bool,
    no_session: bool,
    goose_mode: GooseMode,
) -> Result<Option<String>> {
    if no_session {
        return Ok(None);
    }

    let session_manager = SessionManager::instance();

    let resolved_id = if resume {
        let Some(id) = identifier else {
            let sessions = session_manager
                .list_sessions_by_types(&[SessionType::User])
                .await?;
            let session_id = sessions
                .first()
                .map(|s| s.id.clone())
                .ok_or_else(|| anyhow::anyhow!("No session found to resume"))?;
            return Ok(Some(session_id));
        };

        if let Some(session_id) = id.session_id {
            session_id
        } else if let Some(name) = id.name {
            let sessions = session_manager.list_sessions().await?;
            sessions
                .into_iter()
                .find(|s| s.name == name || s.id == name)
                .map(|s| s.id)
                .ok_or_else(|| anyhow::anyhow!("No session found with name '{}'", name))?
        } else if let Some(path) = id.path {
            path.file_stem()
                .and_then(|s| s.to_str())
                .map(|s| s.to_string())
                .ok_or_else(|| {
                    anyhow::anyhow!("Could not extract session ID from path: {:?}", path)

View on GitHub (pinned to 3810898a74)

Solutions

  1. Check that sessions exist: 'goose session list' (or ls <data_dir>/sessions)
  2. If GOOSE_HOME/GOOSE_DATA_DIR is set, make sure it points at the directory that actually holds your sessions
  3. Start a new session first (drop --resume) so one exists to resume later
  4. Resume an explicit session instead: goose --resume -n <name> or --resume --session-id <id>

Example fix

# before
goose --resume

# after
goose session list   # confirm at least one user session exists
goose --resume --session-id 20250921_143022
Defensive patterns

Strategy: validation

Validate before calling

let sessions = session_manager.list_sessions_by_types(&[SessionType::User]).await?;
if sessions.is_empty() { /* tell user to start a session first; skip --resume */ }

Try / catch

if let Err(e) = run_resume().await {
    if e.to_string().contains("No session found to resume") {
        eprintln!("no sessions yet — starting a new session instead");
        run_new().await?;
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: Running 'goose --resume' (or the run/session equivalent) on a machine where no user-type sessions have been recorded yet, or where sessions live under a different GOOSE_DATA/GOOSE_HOME than the one being read.

Common situations: First run on a fresh install; GOOSE_HOME or XDG data dir pointed elsewhere so the sessions dir looks empty; sessions older than retention/cleanup; wrong user in a container/CI.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/00a995308ee20b6e. Report an issue: GitHub.