{"record":{"id":"cd55991376d0d021","repo":"aaif-goose/goose","slug":"no-sessions-found-cd5599","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":377,"sourceCode":"\n    file.write_all(&diagnostics_data)\n        .context(\"Failed to write diagnostics data\")?;\n\n    println!(\"Diagnostics report saved to: {}\", output_file.display());\n\n    Ok(())\n}\n\n/// Prompt the user to interactively select a session\n///\n/// Shows a list of available sessions and lets the user select one\npub async fn prompt_interactive_session_selection(\n    session_manager: &SessionManager,\n) -> Result<String> {\n    let sessions = session_manager.list_sessions().await?;\n\n    if sessions.is_empty() {\n        return Err(anyhow::anyhow!(\"No sessions found\"));\n    }\n\n    // Build the selection prompt\n    let mut selector = select(\"Select a session to export:\");\n\n    // Map to display text\n    let display_map: std::collections::HashMap<String, Session> = sessions\n        .iter()\n        .map(|s| {\n            let desc = if s.name.is_empty() {\n                \"(no name)\"\n            } else {\n                &s.name\n            };\n            let truncated_desc = safe_truncate(desc, TRUNCATED_DESC_LENGTH);\n\n            let display_text = format!(\"{} - {} ({})\", s.updated_at, truncated_desc, s.id);\n            (display_text, s.clone())","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/commands/session.rs#L359-L395","documentation":"Thrown by prompt_interactive_session_selection (used when `goose session export` runs without an explicit session ID) when list_sessions() returns an empty Vec. The interactive picker needs at least one entry, so an empty visible-session store aborts before showing the selector.","triggerScenarios":"Running `goose session export` with no ID argument on a fresh install or an emptied sessions directory; GOOSE_CONFIG_DIR pointing at an empty store.","commonSituations":"First run after install; after clearing sessions; CI containers with no persisted goose state.","solutions":["Run `goose session list` to confirm the store is empty","Create/resume a session first so at least one exists","Check GOOSE_CONFIG_DIR/GOOSE_HOME points where your sessions live"],"exampleFix":"# before\ngoose session export          # Err: No sessions found\n# after\ngoose session list            # confirm empty\ngoose session new / goose run  # create a session, then export","handlingStrategy":"validation","validationCode":"if session_manager.list_sessions().await?.is_empty() {\n    anyhow::bail!(\"no sessions to export; create one first\");\n}\n// only then run the interactive export flow","typeGuard":"async fn has_exportable_sessions(sm: &SessionManager) -> bool {\n    sm.list_sessions().await.map(|s| !s.is_empty()).unwrap_or(false)\n}","tryCatchPattern":"match prompt_interactive_session_selection(&sm).await {\n    Err(e) if e.to_string() == \"No sessions found\" => Ok(None), // nothing to do\n    other => other.map(Some),\n}","preventionTips":["Pass the session ID explicitly to `goose session export` so the picker never runs","Check `goose session list` is non-empty before interactive flows in scripts"],"tags":["session","export","empty-state","interactive"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}