Session whose Claude transcript no longer exists is still offered for resume: every message dies with "No conversation found with session ID"
Symptom
A Happy session whose Claude transcript no longer exists on disk stays listed and clickable in the app. Opening it and typing anything spawns a claude --resume <uuid> that dies immediately:
Process exited unexpectedly: Claude Code returned an error result:
No conversation found with session ID: e2eb869c-a1c7-4875-be6b-c05a8f11bbd3Every message retries the same doomed spawn. There is no retry loop on the daemon side — the client re-requests on each send — but from the user's side the session is an inert tab that swallows input and answers with the same error forever. Nothing in the UI says the session is unrecoverable.
Root cause
readPersistedSessions() (packages/happy-cli/src/persistence.ts:473) decides what to keep in ~/.happy/sessions.json on two criteria only:
- is
metadata.hostPidstill alive? - is
now - lastAliveAt < SESSION_MAX_AGE_MS(14 days)?
It never checks whether <projectDir>/<claudeSessionId>.jsonl still exists. buildResumeLaunch() (src/resume/handleResumeCommand.ts:80) likewise validates only that metadata.claudeSessionId is a non-empty string before pushing --resume. The daemon resume handler (src/daemon/run.ts:827-841) does await fs.access(launch.cwd) — it verifies the working directory still exists, but not the transcript.
So a record whose lifecycleState is still running and whose lastAliveAt was refreshed recently keeps the session fully live in the UI, pointing at a .jsonl that is gone.
How the transcript goes missing
In my case something else on the machine deleted ~/.claude/projects/*/*.jsonl in bulk. That's my bug, not Happy's — but the transcript can disappear for reasons entirely outside Happy's control:
- Claude Code's own retention sweep (
cleanupPeriodDays, default 30) removes transcripts older than the window - a user cleaning out
~/.claude/projects $HOMEorCLAUDE_CONFIG_DIRchanging between runs- the project directory being renamed, which changes the slug in
getProjectPath()(src/claude/utils/path.ts:4) so the old transcript is no longer where Happy looks
Happy can't prevent any of those. It can stop offering a resume it knows will fail.
Suggested fix
Before --resume is added, check the transcript exists. jsonlPath() and getProjectPath() already compute it (src/claude/utils/claudeSessionFork.ts:43, src/claude/utils/path.ts:4), and claudeSessionFork.ts already has the precedent of ForkSourceMissingError for exactly this condition.
Two places benefit:
- resume path — fail with an explicit "the transcript for this session is gone, it cannot be resumed" instead of letting Claude Code emit
No conversation found with session ID. The user then knows to start a new session rather than retyping into a dead tab. readPersistedSessions()— a record whose process is dead and whose transcript is missing has nothing left to resume; it only survives to offer a broken resume. Dropping it removes the session from the picker. (Worth keeping the "never drop a live process" guard exactly as it is — that record holds the only copy of the encryption key.)
The Codex flavor presumably has the same hole with codexThreadId, but I haven't checked where Codex stores its threads.
Workaround
Delete the key from ~/.happy/sessions.json by hand (back it up first — each record holds a per-session encryption key that cannot be recovered), then remove the orphaned ~/.claude/projects/<slug>/<uuid>/ directory if one is left behind. The daemon re-reads the file on each call, so no restart is needed.
Environment
- happy-cli 1.2.4, daemon started from the daemon (
startedBy: "daemon",dangerouslySkipPermissions: true) - Linux (WSL2), self-hosted server
- affected session record still had
lifecycleState: "running"with ahostPidwhose process had already exited
Source: slopus/happy