Preflight Checklist
What's Wrong?
Sessions become permanently invisible to /resume, --resume, and the session picker when their first non-system user message exceeds approximately 15KB. Running /resume <session-id> or claude --resume <session-id> returns:
Session <session-id> was not found.
The .jsonl session file exists on disk and is valid — the session simply cannot be found by any resume mechanism.
Root cause (traced through the minified CLI source):
The session metadata extractor reads only the first 16,384 bytes of each .jsonl file. The first-prompt parser then processes this buffer line-by-line to extract firstPrompt. A typical continued session starts with:
file-history-snapshot line (~235 bytes) — skipped (not user type)
- Continuation message
[Request interrupted by user for tool use] (~487 bytes) — skipped by filter regex
- The actual first user message — only ~15,662 bytes of buffer remain
If this message exceeds the remaining buffer, the JSON line is truncated. JSON.parse() fails in a catch block that silently continues. The parser returns "". Then the session filter function checks:
if (!firstPrompt && !customTitle) return null;
The session is silently dropped from results. The paginated loader never includes it, so the UUID lookup in the resume handler fails.
This affected 26 out of 42 sessions in my project — every session started by pasting an implementation plan.
What Should Happen?
/resume <session-id> and claude --resume <session-id> should find and resume any session whose .jsonl file exists, regardless of the size of the first user message.
Error Messages/Logs
Session <session-id-here> was not found.
(Same error for every affected session. The error is a normal UI message, not a crash.)
Steps to Reproduce
-
Start a new Claude Code session
-
As the very first message, paste a prompt longer than ~15KB (e.g., a detailed implementation plan). Example:
Implement the following plan:
# My Feature Plan
## Context
[... paste enough text to exceed 15,000 characters total ...]
-
Work in the session normally, then exit
-
Run claude --resume <session-id> using the session ID from the .jsonl filename
-
Result: Session <session-id> was not found.
Why it happens: The session's .jsonl file starts with:
- Line 1:
{"type":"file-history-snapshot",...} (~235 bytes)
- Line 2:
{"parentUuid":"...","type":"user","message":{"content":[{"text":"[Request interrupted by user for tool use]"}]}} (~487 bytes)
- Line 3:
{"parentUuid":null,"type":"user","message":{"content":"Implement the following plan:..."}} (~15,500+ bytes)
The 16KB read buffer (hardcoded to 16,384 bytes) is exhausted partway through Line 3. The truncated JSON fails to parse, firstPrompt stays empty, no customTitle exists, and the session filter returns null.
Workaround: Inject a custom-title entry into the .jsonl file:
{"type":"custom-title","customTitle":"My Title","sessionId":"<uuid>"}
This is read from the file tail (last 16KB) and bypasses the head-read bug.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.42 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Suggested fix options (in order of simplicity):
- Increase the metadata read buffer from 16,384 to 131,072 (128KB) — covers most realistic first messages
- Multi-chunk read in the first-prompt parser — if the buffer ends mid-line without finding a
firstPrompt, read additional chunks
- Skip the
firstPrompt requirement for UUID-based lookups — when the user provides an exact session UUID via --resume, bypass the session filter entirely and load the session directly. The firstPrompt/customTitle filter makes sense for the interactive session picker but not for explicit UUID lookups.
Option 3 is the most robust since it separates "display filtering" from "session existence."
Preflight Checklist
What's Wrong?
Sessions become permanently invisible to
/resume,--resume, and the session picker when their first non-system user message exceeds approximately 15KB. Running/resume <session-id>orclaude --resume <session-id>returns:The
.jsonlsession file exists on disk and is valid — the session simply cannot be found by any resume mechanism.Root cause (traced through the minified CLI source):
The session metadata extractor reads only the first 16,384 bytes of each
.jsonlfile. The first-prompt parser then processes this buffer line-by-line to extractfirstPrompt. A typical continued session starts with:file-history-snapshotline (~235 bytes) — skipped (not user type)[Request interrupted by user for tool use](~487 bytes) — skipped by filter regexIf this message exceeds the remaining buffer, the JSON line is truncated.
JSON.parse()fails in acatchblock that silentlycontinues. The parser returns"". Then the session filter function checks:The session is silently dropped from results. The paginated loader never includes it, so the UUID lookup in the resume handler fails.
This affected 26 out of 42 sessions in my project — every session started by pasting an implementation plan.
What Should Happen?
/resume <session-id>andclaude --resume <session-id>should find and resume any session whose.jsonlfile exists, regardless of the size of the first user message.Error Messages/Logs
Steps to Reproduce
Start a new Claude Code session
As the very first message, paste a prompt longer than ~15KB (e.g., a detailed implementation plan). Example:
Work in the session normally, then exit
Run
claude --resume <session-id>using the session ID from the.jsonlfilenameResult:
Session <session-id> was not found.Why it happens: The session's
.jsonlfile starts with:{"type":"file-history-snapshot",...}(~235 bytes){"parentUuid":"...","type":"user","message":{"content":[{"text":"[Request interrupted by user for tool use]"}]}}(~487 bytes){"parentUuid":null,"type":"user","message":{"content":"Implement the following plan:..."}}(~15,500+ bytes)The 16KB read buffer (hardcoded to 16,384 bytes) is exhausted partway through Line 3. The truncated JSON fails to parse,
firstPromptstays empty, nocustomTitleexists, and the session filter returnsnull.Workaround: Inject a custom-title entry into the
.jsonlfile:{"type":"custom-title","customTitle":"My Title","sessionId":"<uuid>"}This is read from the file tail (last 16KB) and bypasses the head-read bug.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.42 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Suggested fix options (in order of simplicity):
firstPrompt, read additional chunksfirstPromptrequirement for UUID-based lookups — when the user provides an exact session UUID via--resume, bypass the session filter entirely and load the session directly. ThefirstPrompt/customTitlefilter makes sense for the interactive session picker but not for explicit UUID lookups.Option 3 is the most robust since it separates "display filtering" from "session existence."