Conversations with large first messages (images) are invisible in Past Conversations due to 64KB head buffer limit

Status Closed — not planned
Reported on v2.1.59
Maintainer reply None cached
Activity 7 comments · opened Feb 26, 2026 · closed Apr 13, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Conversations that include images (screenshots) in the first user message are invisible in the "Past Conversations" dropdown in the VS Code extension. The .jsonl session file exists on disk and is valid, but the conversation does not appear in the list.

Root cause: FR() in extension.js reads only 64KB (Hx = 65536) from the head of each .jsonl file. When the first user message contains base64-encoded images, the JSON line can be ~5MB, exceeding the buffer. The title extraction chain Gx(tail, "customTitle") || Gx(tail, "summary") || wR(head) fails because wR() receives truncated JSON and returns null. fetchSessions() then skips the conversation entirely.

What Should Happen?

All conversations should appear in "Past Conversations" regardless of message size. The extension should either stream-parse the first user message or write a summary/customTitle as a small separate line in the .jsonl file.

Error Messages/Logs

No error messages. The conversation is silently missing from the list.

Steps to Reproduce

  1. Open a folder in VS Code with the Claude Code extension
  2. Start a new chat
  3. Attach 2-3 screenshots (e.g. phone screenshots ~1125x2436) in your first message along with text
  4. Have a conversation with several exchanges
  5. Close the chat
  6. Click "Past Conversations" — the chat is not listed
  7. Verify the .jsonl file exists: ls ~/.claude/projects/-<encoded-path>/*.jsonl
  8. Check the first user message line size: it will be ~5MB due to base64 images, exceeding the 64KB buffer in FR()

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.59

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Workaround: appending a small customTitle entry to the end of the .jsonl file (within the 64KB tail buffer) makes the conversation visible again:

{"type":"user","customTitle":"Chat title here","isSidechain":false}

The tail is read by the same FR() function with the same 64KB buffer, and Gx(tail, "customTitle") successfully extracts the title.

Suggested fixes:

  • Increase head buffer or use streaming parse for oversized lines
  • Always write customTitle/summary as one of the first small lines in the .jsonl
  • Use a separate lightweight index instead of parsing each .jsonl on every load

View original on GitHub ↗

7 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/26140
  2. https://github.com/anthropics/claude-code/issues/25984
  3. https://github.com/anthropics/claude-code/issues/25721

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

AndrewVoisovych · 7 months ago

⚠️ This is NOT a duplicate — the v2.1.47 fix (16KB→64KB) did not resolve this

I'm hitting the exact same bug on the latest version of the VS Code extension (v2.1.63). The buffer constant is still fK = 65536 in extension.js. I can confirm the root cause analysis in this issue is 100% correct.

Important distinction: Issues #26140, #25920, #25721 were about the CLI /resume path with a 16KB buffer (eS$). That was fixed in v2.1.47 by @ashwin-ant (commit b757fc9). However, the VS Code extension has a separate code path (fetchSessions() → FW() → fK = 65536) that was never fixed — the buffer was already 64KB in the extension, and it's still 64KB in v2.1.63.

My reproduction: no images needed — IDE context alone exceeds 64KB

The original report demonstrates this with base64-encoded screenshots. I want to add that images are not required — the VS Code extension itself injects large IDE context (<ide_opened_file>, <system-reminder>, CLAUDE.md contents, auto-memory) into the first user message, routinely inflating it well beyond 64KB.

Environment:

  • Claude Code VS Code Extension v2.1.63 (latest, darwin-arm64)
  • macOS Darwin 25.2.0
  • Model: claude-opus-4-6

7 affected sessions from my project:

| Session ID | First type:"user" line size | Visible? | Content |
|---|---|---|---|
| 4855730f-... | 372 KB | ❌ Hidden | IDE context + user text |
| 20fa070c-... | 1,008 KB | ❌ Hidden | IDE context + user text |
| 69fa37ed-... | 114 KB | ❌ Hidden | IDE context + user text |
| 4 other sessions | 65–400 KB | ❌ Hidden | IDE context + user text |

None contain images. The inflation comes entirely from the extension's own context injection.

Code path in v2.1.63 (confirming it's unchanged)

// extension.js (v2.1.63)
var fK = 65536;  // ← hardcoded 64KB buffer

async function FW(z) {
    let U = await sK.open(z, "r");
    let v = Buffer.allocUnsafe(fK);
    let N = await U.read(v, 0, fK, 0);  // ← reads only 64KB head
    // ... reads 64KB tail ...
    return { head, tail, mtime, size };
}

// In fetchSessions():
let q = uK(x, "customTitle") || uK(x, "summary") || LW(j);
if (!q) return null;  // ← session silently dropped when all three fail

LW(head) (the prompt extractor) tries JSON.parse() on truncated lines → fails silently → returns null → session is invisible.

Why increasing the buffer won't fix this long-term

The extension injects unbounded context into the first message — IDE selections, opened files, system reminders, CLAUDE.md, memory files. This will only grow as features are added. Bumping fK to 1MB is a band-aid.

Suggested fix: write a metadata header early in the .jsonl

When creating a new session, write a small metadata line as the 2nd or 3rd line (after queue-operation):

{"type":"session-meta","summary":"First 200 chars of user prompt...","created":"2026-03-02T12:00:00Z"}

This guarantees LW() always finds parseable content within the 64KB head, regardless of how large subsequent messages are. Minimal code change, maximum robustness.

Workaround (fragile)

Manually appending a summary entry to the .jsonl tail:

{"type":"summary","summary":"Description","leafUuid":"<last-uuid>"}

This works via uK(tail, "summary"), BUT it's fragile — the extension continues appending data (subagent results, file-history-snapshots) which can push the summary outside the 64KB tail window, making the session invisible again. I've observed this happen in practice.

---

@ashwin-ant This is a continuation of the buffer issue you fixed in v2.1.47. The 16KB→64KB increase resolved the CLI /resume path, but the VS Code extension's FW() / fetchSessions() has the same class of bug — and it's triggered much more easily because the extension itself injects large IDE context into the first message. Still present in v2.1.63.

@hackyon-anthropic This lives in the VS Code extension's extension.js — fK = 65536 in FW() and the LW() title extraction chain. An architectural fix (metadata header) would be more robust than bumping the buffer.

cc @chrislloyd @vbhavsar (related: #26140, #25721, #25920)

ryu16 · 7 months ago

I independently found the same issue on Windows 11 + VSCode extension v2.1.69.

In my case, the first user message contained a base64-encoded PDF (~2.3MB), making line 4 of the .jsonl file 2,361,422 bytes. The 64KB head buffer in Ys() truncates this line, JSON.parse() fails, and Ts() returns empty ? so UU() returns null and the session is excluded.

As a temporary workaround, I changed sV=65536 to sV=4194304 in extension.js and the session appeared immediately.

interconnectedMe · 7 months ago

This issue is part of a family of ~20 bugs that all stem from the same root cause: the VS Code extension reads titles by raw-string-scanning the last 64KB of each JSONL file, which causes title eviction on long sessions, cross-session contamination from tool result content, and overwrite-on-resume.

See #33165 (comment: https://github.com/anthropics/claude-code/issues/33165#issuecomment-4070011372) for the full root cause analysis, all related issues collected, and a working workaround (persistent title registry + hook).

github-actions[bot] · 6 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

AndyHaack · 6 months ago

This bug is still present in v2.1.108 and silently affects many users reporting "session loss".

I independently investigated disappearing sessions on Windows 11 / VS Code and traced it to the same 64KB D2 buffer in Pp() → Yq4(). In my case, 22 out of 193 sessions were silently dropped — every single one had a first user message containing pasted screenshots with base64 data exceeding 64KB.

Additional findings:

  • The sessions are present in sessions-index.json (the CLI knows about them) but the VS Code extension's listSessions() → Fd() → xZ4() → Cp() → Pp() chain drops them because Pp() returns null
  • Multiple open "session loss" issues (#38691, #9258, #41455, #31787) likely have this as root cause but attribute it to race conditions or update data loss
  • This is not edge-case behavior — attaching screenshots is a core workflow for VS Code users

Workaround that works: Inject a {"type":"ai-title","aiTitle":"..."} record after the queue-operation lines at the top of each affected .jsonl file. This puts the title within the 64KB head window. All 22 sessions reappeared immediately after VS Code reload.

Suggested fix: Write the ai-title record early in the .jsonl file (immediately after generating it), not just inline after the first assistant response. This would be a one-line change and permanently prevent the issue. Alternatively, increase D2 to 1MB, or fall back to a generic title instead of returning null.

Closing this as "not planned" means every user who pastes screenshots in their first message permanently loses those sessions from the sidebar. Please reconsider.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.