{"record":{"id":"00a995308ee20b6e","repo":"aaif-goose/goose","slug":"no-session-found-to-resume","errorCode":null,"errorMessage":"No session found to resume","messagePattern":"No session found to resume","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/cli.rs","lineNumber":414,"sourceCode":"    resume: bool,\n    no_session: bool,\n    goose_mode: GooseMode,\n) -> Result<Option<String>> {\n    if no_session {\n        return Ok(None);\n    }\n\n    let session_manager = SessionManager::instance();\n\n    let resolved_id = if resume {\n        let Some(id) = identifier else {\n            let sessions = session_manager\n                .list_sessions_by_types(&[SessionType::User])\n                .await?;\n            let session_id = sessions\n                .first()\n                .map(|s| s.id.clone())\n                .ok_or_else(|| anyhow::anyhow!(\"No session found to resume\"))?;\n            return Ok(Some(session_id));\n        };\n\n        if let Some(session_id) = id.session_id {\n            session_id\n        } else if let Some(name) = id.name {\n            let sessions = session_manager.list_sessions().await?;\n            sessions\n                .into_iter()\n                .find(|s| s.name == name || s.id == name)\n                .map(|s| s.id)\n                .ok_or_else(|| anyhow::anyhow!(\"No session found with name '{}'\", name))?\n        } else if let Some(path) = id.path {\n            path.file_stem()\n                .and_then(|s| s.to_str())\n                .map(|s| s.to_string())\n                .ok_or_else(|| {\n                    anyhow::anyhow!(\"Could not extract session ID from path: {:?}\", path)","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/cli.rs#L396-L432","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check that sessions exist: 'goose session list' (or ls <data_dir>/sessions)","If GOOSE_HOME/GOOSE_DATA_DIR is set, make sure it points at the directory that actually holds your sessions","Start a new session first (drop --resume) so one exists to resume later","Resume an explicit session instead: goose --resume -n <name> or --resume --session-id <id>"],"exampleFix":"# before\ngoose --resume\n\n# after\ngoose session list   # confirm at least one user session exists\ngoose --resume --session-id 20250921_143022","handlingStrategy":"validation","validationCode":"let sessions = session_manager.list_sessions_by_types(&[SessionType::User]).await?;\nif sessions.is_empty() { /* tell user to start a session first; skip --resume */ }","typeGuard":null,"tryCatchPattern":"if let Err(e) = run_resume().await {\n    if e.to_string().contains(\"No session found to resume\") {\n        eprintln!(\"no sessions yet — starting a new session instead\");\n        run_new().await?;\n    } else { return Err(e); }\n}","preventionTips":["Run 'goose session list' before scripting --resume","Keep GOOSE_HOME stable across invocations","Wrap --resume in scripts with an existence check on the sessions dir"],"tags":["cli","session","resume","goose"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}