/resume command silently drops sessions with large first messages (>~15KB)
Resolved 💬 2 comments Opened Feb 14, 2026 by esperie Closed Feb 16, 2026
Bug Description
The /resume <session-id> command returns "Session was not found" for sessions where the first user message exceeds approximately 15KB, even though the session file exists and claude --resume <session-id> from the terminal works correctly.
Steps to Reproduce
- Start a session where the first user message is large (e.g., pasting a detailed plan >15KB)
- End the session
- Try
/resume <session-id>from within another session - Observe: "Session
<id>was not found." - Try
claude --resume <session-id>from the terminal - Observe: Session loads successfully
Root Cause
Traced through the compiled binary (v2.1.42). The /resume command's session lookup pipeline:
UR0()scans project directories for.jsonlsession files viadpT()— works correctly, session is foundV1T()enriches entries by callingky8()for each sessionky8()callsby8()which reads only the first 16,384 bytes (16KB) of the.jsonlfileby8()→yy8()splits the buffer by newlines and tries toJSON.parse()each line looking for the first user message- If the user message line extends beyond the 16KB buffer, the line is truncated and
JSON.parse()fails silently (caught by try/catch) firstPromptremains emptyky8()applies the filter:if (!_.firstPrompt && !_.customTitle) return null— session is dropped
The relevant code path:
/resume <uuid>
→ Cp(f9()) // get project paths via git worktree list
→ nPR(paths) // load sessions
→ $lT(paths)
→ UR0(paths) // scan dirs, create lite entries with sessionId from filename
→ V1T(entries, 0, 10) // enrich first 10
→ ky8(entry) // reads first/last 16KB
→ by8() // buffer too small for large first messages
→ yy8() // JSON.parse fails on truncated line
→ returns null (no firstPrompt, no customTitle)
Example File Layout
line 0: {"type":"file-history-snapshot",...} ~236 bytes
line 1: {"type":"progress",...} ~617 bytes
line 2: {"type":"user","message":{...}} ~19,301 bytes ← exceeds remaining buffer
The 16KB buffer contains lines 0-1 fully and only ~15,530 bytes of line 2. The truncated JSON fails to parse, so firstPrompt is never extracted.
Expected Behavior
/resume <session-id> should find and resume any valid session, regardless of the first message size.
Suggested Fixes
- Option A: When looking up by exact UUID (not searching by title), skip the
ky8enrichment filter entirely — the session ID match is sufficient - Option B: Increase the read buffer or implement line-aware reading that follows truncated lines
- Option C: Fall back to reading more data when the first user message isn't found in the initial buffer
Environment
- Claude Code version: 2.1.42
- OS: macOS (Darwin, arm64)
- The session file exists in the correct project directory and has valid content
🤖 Generated with Claude Code
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗