Named sessions not resumable by name after process exit

Resolved 💬 3 comments Opened Apr 15, 2026 by JobaDiniz Closed Apr 19, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When a named session's process exits (terminal closed, crash, etc.), claude -r <name> can no longer find it. The session data (JSONL) is fully intact on disk and claude --resume <session-id> works fine — but the name is lost.

Root cause: Session names are only stored in ~/.claude/sessions/<pid>.json, which gets cleaned up when the process exits. The name is not persisted in the session JSONL file or any durable index.

Evidence from disk inspection:

# Active sessions only track running PIDs — name lives here and dies with the process
~/.claude/sessions/31372.json → {"pid":31372,"sessionId":"6784ab79-...","name":"reprocess tool"}

# Session JSONL (72MB, 12810 lines) has no name metadata
~/.claude/projects/<project>/06c8aeae-....jsonl → no "sessionName" or "name" field in any record

# history.jsonl references sessionId but not session name

This is especially painful for long-lived sessions (this one was 72MB with multiple compactions over weeks of work).

What Should Happen?

claude -r <name> should find named sessions even after the owning process has exited. Session name should be persisted durably — either in the JSONL file (e.g., as a metadata record) or in a separate session index that survives process exit.

Steps to Reproduce

  1. Start a session: claude
  2. Name it via /name v4 (or however session naming works)
  3. Close the terminal (or kill the process)
  4. Try claude -r v4not found
  5. Try claude --resume 06c8aeae-... (full session ID) → works

Claude Model

Opus

Is this a regression?

Unknown — may have always been this way

Claude Code Version

2.1.101

Platform

Anthropic API (Claude Max)

Operating System

Windows 11 Pro

Terminal/Shell

Git Bash

Additional Information

Related issues: #40081 (sessions disappearing from /resume after restart), #46553 (incomplete session list), #42681 (resume broken after update). This is a distinct root cause — the name specifically is not persisted, while the session data itself survives.

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗