aaif-goose/goose · warning

No sessions found.

Error message

No sessions found.

What it means

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).

Source

Thrown at crates/goose-cli/src/commands/session.rs:134

        }
    } else if let Some(regex_val) = regex_string {
        let session_regex = Regex::new(&regex_val)
            .with_context(|| format!("Invalid regex pattern '{}'", regex_val))?;

        let visible_sessions = session_manager.list_sessions().await?;
        matched_sessions = visible_sessions
            .into_iter()
            .filter(|session| session_regex.is_match(&session.id))
            .collect();

        if matched_sessions.is_empty() {
            println!("Regex string '{}' does not match any sessions", regex_val);
            return Ok(());
        }
    } else {
        let visible_sessions = session_manager.list_sessions().await?;
        if visible_sessions.is_empty() {
            return Err(anyhow::anyhow!("No sessions found."));
        }
        matched_sessions = prompt_interactive_session_removal(&visible_sessions)?;
    }

    if matched_sessions.is_empty() {
        return Ok(());
    }

    remove_sessions(&session_manager, matched_sessions).await
}

fn write_line_or_broken_pipe_ok<W: Write>(out: &mut W, line: &str) -> Result<bool> {
    match writeln!(out, "{line}") {
        Ok(()) => Ok(true),
        Err(e) if e.kind() == io::ErrorKind::BrokenPipe => Ok(false),
        Err(e) => Err(e.into()),
    }
}

View on GitHub (pinned to 3810898a74)

Solutions

  1. Run `goose session list` to confirm there really are no visible sessions
  2. Check GOOSE_CONFIG_DIR/GOOSE_HOME resolves to the expected sessions directory
  3. If sessions exist but are hidden, remove them explicitly with `--id` or `--regex`

Example fix

# before
goose session remove                 # Err: No sessions found.
# after
goose session list                   # verify store is empty / find ids
goose session remove --regex '.*'    # explicit removal path
Defensive patterns

Strategy: validation

Validate before calling

if session_manager.list_sessions().await?.is_empty() {
    println!("no visible sessions; nothing to remove");
    return Ok(());
}
handle_session_remove(None, None, None).await?;

Type guard

async fn has_visible_sessions(sm: &SessionManager) -> bool {
    sm.list_sessions().await.map(|s| !s.is_empty()).unwrap_or(false)
}

Try / catch

match handle_session_remove(None, None, None).await {
    Err(e) if e.to_string() == "No sessions found." => Ok(()), // empty store is fine
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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