listSessions() silently drops sessions whose first user message contains a large base64 image
listSessions() silently drops valid, resumable sessions when the first user message contains a large inline base64 image (e.g. a pasted screenshot). The session file exists on disk and unstable_v2_resumeSession() works fine, but the session is invisible to listSessions().
Root cause: The session-file parser reads only the first 64KB of each JSONL file. When the first user message contains a base64-encoded image, that single JSONL line can be 200KB+. At 64KB the line is truncated, JSON.parse fails silently, no firstPrompt is extracted, and the parser returns null.
Measurements from a real session:
- File: 586KB, 138 lines, all valid JSON
- First user message line (image + text): 219,055 bytes
- SDK read buffer: 65,536 bytes
Related: #29837 reports the same symptoms (536KB file, missing from list, --resume <id> works). Closed as duplicate of #18311, but that's a different bug (missing JSONL files entirely).
SDK version: 0.2.86
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗