Sessions starting with image-only messages are invisible in Past Conversations

Resolved 💬 4 comments Opened Mar 7, 2026 by oohhddaanngg Closed Mar 11, 2026

Bug Description

Sessions whose first user message contains only an image (no text) disappear from the "Past Conversations" panel after a restart. The session files exist on disk but are not listed.

Root Cause (from source analysis)

The fetchSessions() function in the VS Code extension reads the first 64 KB (D1=65536) of each .jsonl session file to extract a display name via the mR() fallback function. This function scans for the first "type":"user" line and extracts text-type content.

When the first user message is an image paste (e.g., a screenshot), the single JSONL line containing the base64-encoded image is ~1 MB — far exceeding the 64 KB buffer. The buffer captures only a truncated, unparseable fragment of that line. No subsequent user messages fall within the buffer window.

Since mR() returns empty and no customTitle/lastPrompt/summary markers exist in the file tail, the session is filtered out (if(!D) return null).

Steps to Reproduce

  1. Open a project in VS Code with Claude Code extension
  2. Start a new conversation by pasting a screenshot as the first message (no text)
  3. Have a full conversation with multiple text messages after the image
  4. Close the conversation
  5. Restart VS Code / code-server
  6. Open "Past Conversations" — the session is missing

Expected Behavior

All sessions should appear in "Past Conversations" regardless of whether the first message contains text or images.

Suggested Fixes

  1. Write a lastPrompt entry to the tail of the JSONL file when the session ends, so zU(x,"lastPrompt") finds it without needing to parse the head
  2. Skip unparseable lines in mR() and continue scanning within the buffer rather than silently consuming the budget on a truncated line
  3. Increase the buffer or use a streaming line reader that can skip large lines
  4. Fall back to a generic title (e.g., "Image conversation - {date}") instead of filtering the session out entirely

Environment

  • Claude Code extension v2.1.70 (code-server / VS Code)
  • Sessions stored in ~/.claude/projects/<project>/
  • Affected sessions: first message is {"type":"user","message":{"content":[{"type":"image",...}]}} with ~1 MB base64 data per line

Evidence

# First user message line sizes in affected sessions:
88054c6c.jsonl: 1,085,662 bytes (vs 65,536 byte buffer)
c059137e.jsonl: 1,071,836 bytes (vs 65,536 byte buffer)

# Working sessions in other projects start with text:
# First user message at ~2,300 bytes — well within buffer

Workaround

Start sessions with a short text message before pasting screenshots.

View original on GitHub ↗

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