anthropics / anthropics/claude-code

[BUG] Exit hint prints `claude --resume "<title>"` for sessions the resume list hides (first user message is a slash command)

Open
#95,482 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:cli bug has repro platform:macos
Dominant language
TypeScript
Stars
146k
Forks
23.8k
PR merge metrics
PR metrics pending

Description

What happened

On exit, Claude Code printed:

Resume this session with:
  claude --resume "product - new"

Running that exact command does not resume. It opens the session picker with product - new pre-filled in the search box and no match. The same session is also missing from claude -r's list entirely. Resuming it by UUID works fine.

So the exit hint emits a command that can never succeed for this class of session.

Root cause (bisected)

The session list that backs both claude -r and title-based --resume excludes sessions whose first user message is a slash-command invocation. The exit hint, however, is generated from the custom title without checking that the title is resolvable.

The session in question was started with /loop (args /ap), so its first type:"user" record is:

{"role":"user","content":"<command-message>loop</command-message>\n<command-name>/loop</command-name>\n<command-args>/ap</command-args>"}
A/B that isolates it

Copied the same 65 MB transcript twice into a throwaway project directory, rewriting only sessionId and cwd so both are valid for that project:

fixture first user message appears in claude -r
unmodified copy <command-name>/loop</command-name> no
identical copy, only that one record's content replaced with plain text plain text yesproduct - new · 65.5MB

Controls that rule out size / record count (both synthetic, plain-text first message, both listed fine):

fixture size records appears
few huge records 76.3 MB 81 yes
many small records 11.4 MB 25,001 yes

An unrelated control also confirms title resume itself works: a fixture with custom-title.json = ZZZ-custom-name and a plain first message resumes correctly via claude --resume "ZZZ-custom-name", while claude --resume "<its auto-generated title>" returns No sessions match.

Repro
  1. Start a session whose first user message is a slash command (e.g. claude then /loop <something> as the very first prompt).
  2. Give it a custom title (Ctrl+R in the resume picker, or rename in-session).
  3. Exit — note the printed claude --resume "<title>" hint.
  4. Run that exact command → picker opens with the title pre-filled and no match. The session is also absent from claude -r.
  5. claude --resume <uuid> works.
Expected

Either:

  • the session list should not exclude sessions whose first message is a slash command (they are ordinary user-started sessions), or
  • the exit hint should print claude --resume <uuid> when the title is not resolvable.

The current combination is the worst case: the product tells you a command and the same product then cannot act on it.

Environment
  • Claude Code 2.1.277 (native install), macOS 15.6 / Darwin 25.6.0
  • Session was created by 2.1.273; transcript 23,389 records, 68 MB
  • The custom-title.json sidecar existed and contained the exact string that was printed

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests; start by tracing the session-list and title-based resume entry points, then the exit-hint generation. Reproduce with a session whose first user message is a slash command and compare it with a plain-text fixture. Done means the session appears in the resume list and the printed hint successfully resumes it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.