{"record":{"id":"5b288f0382bff741","repo":"aaif-goose/goose","slug":"no-sessions-found","errorCode":null,"errorMessage":"No sessions found.","messagePattern":"No sessions found\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/goose-cli/src/commands/session.rs","lineNumber":134,"sourceCode":"        }\n    } else if let Some(regex_val) = regex_string {\n        let session_regex = Regex::new(&regex_val)\n            .with_context(|| format!(\"Invalid regex pattern '{}'\", regex_val))?;\n\n        let visible_sessions = session_manager.list_sessions().await?;\n        matched_sessions = visible_sessions\n            .into_iter()\n            .filter(|session| session_regex.is_match(&session.id))\n            .collect();\n\n        if matched_sessions.is_empty() {\n            println!(\"Regex string '{}' does not match any sessions\", regex_val);\n            return Ok(());\n        }\n    } else {\n        let visible_sessions = session_manager.list_sessions().await?;\n        if visible_sessions.is_empty() {\n            return Err(anyhow::anyhow!(\"No sessions found.\"));\n        }\n        matched_sessions = prompt_interactive_session_removal(&visible_sessions)?;\n    }\n\n    if matched_sessions.is_empty() {\n        return Ok(());\n    }\n\n    remove_sessions(&session_manager, matched_sessions).await\n}\n\nfn write_line_or_broken_pipe_ok<W: Write>(out: &mut W, line: &str) -> Result<bool> {\n    match writeln!(out, \"{line}\") {\n        Ok(()) => Ok(true),\n        Err(e) if e.kind() == io::ErrorKind::BrokenPipe => Ok(false),\n        Err(e) => Err(e.into()),\n    }\n}","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/commands/session.rs#L116-L152","documentation":"Raised when `goose session remove` is invoked with no --id, --name, or --regex and the interactive picker finds zero visible sessions via list_sessions(). The command refuses to open an empty selector, so this error means the visible session store is empty (hidden sessions are excluded from this path).","triggerScenarios":"Running plain `goose session remove` on a fresh install with no sessions; all sessions are hidden or of excluded types; GOOSE_CONFIG_DIR points at an empty or wrong sessions directory.","commonSituations":"First use after install; after deleting all session files manually; CI or container environments with a fresh GOOSE_CONFIG_DIR; pointing the env var at a new directory to 'reset' goose.","solutions":["Run `goose session list` to confirm there really are no visible sessions","Check GOOSE_CONFIG_DIR/GOOSE_HOME resolves to the expected sessions directory","If sessions exist but are hidden, remove them explicitly with `--id` or `--regex`"],"exampleFix":"# before\ngoose session remove                 # Err: No sessions found.\n# after\ngoose session list                   # verify store is empty / find ids\ngoose session remove --regex '.*'    # explicit removal path","handlingStrategy":"validation","validationCode":"if session_manager.list_sessions().await?.is_empty() {\n    println!(\"no visible sessions; nothing to remove\");\n    return Ok(());\n}\nhandle_session_remove(None, None, None).await?;","typeGuard":"async fn has_visible_sessions(sm: &SessionManager) -> bool {\n    sm.list_sessions().await.map(|s| !s.is_empty()).unwrap_or(false)\n}","tryCatchPattern":"match handle_session_remove(None, None, None).await {\n    Err(e) if e.to_string() == \"No sessions found.\" => Ok(()), // empty store is fine\n    other => other,\n}","preventionTips":["Guard interactive commands behind a non-empty `goose session list` check in scripts","Set GOOSE_CONFIG_DIR deliberately so you know which store you are operating on","Use explicit --id/--regex filters in automation instead of the interactive path"],"tags":["session","cli","empty-state","rust"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}