aaif-goose/goose · error
Session ID '{}' not found.
Error message
Session ID '{}' not found. What it means
Thrown by `goose session remove --id <ID>` when SessionManager::get_session(id, false) returns Err, meaning no session with that ID exists in the session store. The boolean argument only controls loading messages (here false = metadata lookup only), so any Err is an existence/read failure. goose throws it because removal must resolve the ID to exactly one stored session before deleting anything.
Source
Thrown at crates/goose-cli/src/commands/session.rs:105
.filter_map(|text| display_map.get(&text).cloned())
.collect();
Ok(selected_sessions)
}
pub async fn handle_session_remove(
session_id: Option<String>,
name: Option<String>,
regex_string: Option<String>,
) -> Result<()> {
let session_manager = SessionManager::instance();
let matched_sessions: Vec<Session>;
if let Some(id_val) = session_id {
match session_manager.get_session(&id_val, false).await {
Ok(session) => matched_sessions = vec![session],
Err(_) => return Err(anyhow::anyhow!("Session ID '{}' not found.", id_val)),
}
} else if let Some(name_val) = name {
let all_sessions = session_manager.list_all_sessions().await?;
if let Some(session) = all_sessions.into_iter().find(|s| s.name == name_val) {
matched_sessions = vec![session];
} else {
return Err(anyhow::anyhow!(
"Session with name '{}' not found.",
name_val
));
}
} else if let Some(regex_val) = regex_string {
let session_regex = Regex::new(®ex_val)
.with_context(|| format!("Invalid regex pattern '{}'", regex_val))?;
let visible_sessions = session_manager.list_sessions().await?;
matched_sessions = visible_sessions
.into_iter()View on GitHub (pinned to 3810898a74)
Solutions
- Run `goose session list` and copy the exact, full session ID
- Remove by name (`--name`) or by regex on the ID (`--regex`) instead
- Verify GOOSE_CONFIG_DIR/GOOSE_HOME matches the directory the session was created in
- Check the sessions directory for the <id>.jsonl file to confirm whether it still exists
Example fix
# before goose session remove --id 20260101_000000_ab # after goose session list # copy the exact id goose session remove --id 20260101_000000_abc-def0123-full
Defensive patterns
Strategy: validation
Validate before calling
let ids: Vec<String> = session_manager
.list_all_sessions()
.await?
.into_iter()
.map(|s| s.id)
.collect();
if !ids.contains(&session_id) {
return Ok(()); // nothing to remove; skip instead of erroring
}
handle_session_remove(Some(session_id), None, None).await?; Type guard
fn session_id_exists(ids: &[String], id: &str) -> bool {
ids.iter().any(|s| s == id)
} Try / catch
match handle_session_remove(Some(id.clone()), None, None).await {
Ok(_) => {}
Err(e) if e.to_string().contains("not found") => {
// id already gone: treat as success, do not fail the script
}
Err(e) => return Err(e),
} Prevention
- Always derive IDs programmatically from `goose session list` output instead of hand-typing them
- Pin GOOSE_CONFIG_DIR explicitly in scripts so the session store is deterministic
- Prefer --name or --regex from the listed values when IDs may be unstable
When it happens
Trigger: Running `goose session remove --id <uuid>` with a misspelled or truncated ID; the session .jsonl file was deleted from the sessions directory; GOOSE_CONFIG_DIR/GOOSE_HOME points at a different session store than the one that created the session.
Common situations: Copy-pasting a shortened ID from `goose session list` output; referencing a session created under another user or machine; manually cleaning ~/.config/goose/sessions; scripts that assume a session ID is still present after cleanup.
Related errors
- Session with name '{}' not found.
- No sessions found.
- Session '{}' not found or failed to read: {}
- state-machine session loaded without conversation
- No session found to resume
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/758e6f8c6b1ca8ba.
Report an issue: GitHub.