charmbracelet/crush · error
session not found: %s
Error message
session not found: %s
What it means
resolveSession looked up the given session ID via app.Sessions.Get and the record does not exist (or the DB lookup failed). The tool cannot continue a conversation with an unknown session ID.
Source
Thrown at internal/app/app.go:246
// is nil-safe. Call this whenever the active session changes (load,
// new, or select).
func (app *App) ReportCurrentSession(sessionID string) {
app.herdrClient.SetSessionID(sessionID)
}
// resolveSession resolves which session to use for a non-interactive run
// If continueSessionID is set, it looks up that session by ID
// If useLast is set, it returns the most recently updated top-level session
// Otherwise, it creates a new session
func (app *App) resolveSession(ctx context.Context, continueSessionID string, useLast bool) (session.Session, error) {
switch {
case continueSessionID != "":
if app.Sessions.IsAgentToolSession(continueSessionID) {
return session.Session{}, fmt.Errorf("cannot continue an agent tool session: %s", continueSessionID)
}
sess, err := app.Sessions.Get(ctx, continueSessionID)
if err != nil {
return session.Session{}, fmt.Errorf("session not found: %s", continueSessionID)
}
if sess.ParentSessionID != "" {
return session.Session{}, fmt.Errorf("cannot continue a child session: %s", continueSessionID)
}
return sess, nil
case useLast:
sess, err := app.Sessions.GetLast(ctx)
if err != nil {
return session.Session{}, fmt.Errorf("no sessions found to continue")
}
return sess, nil
default:
return app.Sessions.Create(ctx, agent.DefaultSessionName)
}
}
View on GitHub (pinned to 7944b8e522)
Solutions
- List existing sessions and copy the exact ID (crush sessions or equivalent command).
- Confirm you are in the same project directory — sessions are stored per data directory.
- Omit the session flag to create a new session instead of continuing.
- Check the ID for typos/truncation (UUID must match exactly).
Example fix
// before crush run --continue 9f8e7d2c-1111-2222-3333-444455556666 "fix the bug" // after crush sessions # verify the ID exists in this project crush run --continue <verified-id> "fix the bug"
Defensive patterns
Strategy: validation
Validate before calling
if _, err := app.Sessions.Get(ctx, sessionID); err != nil {
return fmt.Errorf("session %s does not exist in this project's data dir", sessionID)
} Try / catch
if err != nil {
if strings.HasPrefix(err.Error(), "session not found") {
sess, cerr := app.Sessions.Create(ctx, agent.DefaultSessionName) // fall back to new session
if cerr != nil { return cerr }
_ = sess
}
return err
} Prevention
- Copy session IDs from `crush sessions` output, not memory or logs.
- Remember sessions are stored per data directory — same project, same user.
- Do not wipe the crush data directory while scripts hold session IDs.
When it happens
Trigger: Passing a --continue/--session ID that was never created, was deleted, was created in a different project/data directory (different SQLite file), or contains a typo.
Common situations: Reusing session IDs across different working directories or after wiping ~/.local/share/crush; stale IDs in shell scripts; truncated/copied-partial IDs from logs.
Related errors
- cannot continue an agent tool session: %s
- cannot continue a child session: %s
- no sessions found to continue
- failed to resolve session: %w
- session not found: %s
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/6d4530886be2390f.
Report an issue: GitHub.