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

No session found with name '{}'

Error message

No session found with name '{}'

What it means

anyhow error from the resume branch of CLI session resolution (crates/goose-cli/src/cli.rs) when an identifier was given via -n/--name (no --session-id) and no listed session matches s.name == name || s.id == name. The name lookup is an exact, case-sensitive match against stored session names or ids.

Source

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

            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)
                })?
        } else {
            return Err(anyhow::anyhow!("Invalid identifier"));
        }
    } else {
        let Some(id) = identifier else {
            let session = session_manager
                .create_session(
                    std::env::current_dir()?,
                    "CLI Session".to_string(),
                    SessionType::User,
                    goose_mode,

View on GitHub (pinned to 3810898a74)

Solutions

  1. List sessions and copy the exact name: 'goose session list'
  2. Retry with the exact stored name or use the session id directly: goose --resume --session-id <id>
  3. Check casing/whitespace — matching is exact
  4. Verify GOOSE_HOME/data dir points where the session was created

Example fix

# before
goose --resume -n ProjectX

# after
goose session list                # get exact name, e.g. 'project-x'
goose --resume -n project-x
Defensive patterns

Strategy: validation

Validate before calling

let exists = session_manager.list_sessions().await?.iter().any(|s| &s.name == name || &s.id == name);
if !exists { /* list candidates for the user instead of failing */ }

Try / catch

match resolve_resume().await {
    Err(e) if e.to_string().contains("No session found with name") => {
        print_available_sessions().await?; // help the user self-correct
        return Err(e);
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running 'goose --resume -n mysession' where 'mysession' was never stored (typo, different casing, leading/trailing space) or the session lives in a different data dir; the same string is also tried as a session id and fails.

Common situations: Renaming or deleting the session earlier; name set in a different GOOSE_HOME; quoting issues adding whitespace in shell; expecting fuzzy/prefix matching where only exact match exists.

Related errors


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