[BUG] VS Code extension: pasting a very large screenshot causes runaway memory (~190GB footprint) and repeated macOS kernel panics
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?
[BUG] VS Code extension: pasting a very large screenshot causes runaway memory (~190GB footprint) and repeated macOS kernel panics
Summary
Pasting a large full-screen Retina screenshot (5712×4284 px, ~90MB PNG → ~120MB as base64) into the Claude Code VS Code extension chat caused unbounded memory growth that exhausted 64GB of RAM plus swap and kernel-panicked the machine (watchdog timeout) three times in one day. The extension performs no client-side size validation on pasted images (the Anthropic API limit is 5MB per image), and once the oversized message enters the webview → extension host → CLI pipeline, memory grows at roughly GB/minute until the system dies.
Because VS Code restores the session after reboot and the user naturally retries the conversation, the crash re-triggers shortly after every restart — a crash loop at the whole-machine level.
Environment
- Claude Code VS Code extension: 2.1.201 (
anthropic.claude-code-2.1.201-darwin-arm64) - Claude Code CLI (bundled native binary): 2.1.201
- VS Code: 1.127.0
- macOS: 26.5.1 (25F80), Apple Silicon (Mac15,9, 16 cores, 64GB RAM)
What happened (timeline, 2026-07-06, times BST)
| Time | Event |
|---|---|
| ~10:39–16:12 | Long Claude Code session in the extension (3 image attachments over the day) |
| ~16:13 | Kernel panic #1 (watchdog timeout — memory exhaustion) |
| 16:14 | Reboot; VS Code restores; new Claude session resumed |
| ~16:27 | Kernel panic #2 — only ~13 minutes after boot |
| 16:28 | Reboot; VS Code restores |
| 16:44:59 | User pastes full-screen screenshot into the chat; the extension logs a single 120,078,654-byte log line containing the entire base64 image. This is the last entry the extension ever logs |
| 17:06 | macOS flags the extension-spawned node process for sustained disk writes: 2,147.49MB dirtied over 2,164s (~1MB/s) (node_2026-07-06-170603 resource diag) |
| 17:08 | JetsamEvent: system memory exhausted. Compressor holds 1,494,235 compressed pages storing 11,603,169 uncompressed pages ≈ 190GB — an ~8:1 ratio consistent with highly repetitive data (duplicated base64 text). VS Code relaunches |
| ~17:28 | User retries the session; kernel panic #3 |
Activity Monitor attributed ~200GB of memory footprint to the VS Code process group before each crash.
Evidence (attached zip)
JetsamEvent-2026-07-06-170817.ips— kernel memory-exhaustion event; seememoryStatus.uncompressed= 11,603,169 pages × 16KB ≈ 190GBpanic-base+socd-2026-07-06-{161509,162954,173112}.000.panic— three kernel panics, allwatchdog timeout: no checkins from watchdogdnode_2026-07-06-170603_Bens-MacBook-Pro.diag— disk-writes resource violation by a node process in thecom.microsoft.VSCodecoalition, spanning boot → jetsamclaude-vscode-extension-log-REDACTED.txt— structure of the 120MB single-line extension log entry (Received message from webviewwith inline base64 image), base64 payload redacted
Session transcript last-write times in ~/.claude/projects/ correlate 1:1 with all three panics (16:12, 16:23→~16:27 panic, 17:07→17:08 jetsam, 17:28→panic).
Steps to reproduce
- On macOS, take a full-screen screenshot on a Retina display showing photo-heavy content (mine was 5712×4284; the PNG was ~90MB because photographic content defeats PNG compression)
- Paste it into the Claude Code VS Code extension chat with a short prompt and send
- Watch the VS Code process group's memory footprint in Activity Monitor
Observed: memory grows on the order of GB/minute; extension logging stops entirely after the paste; within ~20–60 minutes (64GB RAM + fast SSD swap) the system watchdog-panics.
Expected behavior
- The extension should validate pasted-image size client-side and downscale or reject images exceeding API limits (5MB per image) instead of ingesting a 120MB base64 payload
- Whatever pipeline stage duplicates the message (webview ↔ extension host ↔ CLI stream-json replay) should not retain unbounded copies — ~190GB / ~120MB suggests on the order of 1,500+ retained copies of the same string
- The extension should not write a 120MB single-line entry to the output-channel log
Related issues
Possibly the same underlying leak as #21182, #22716, #12814 — this report adds a deterministic amplifier (oversized pasted image) and full kernel-level forensics.
What Should Happen?
The extension should validate pasted-image size client-side and downscale or reject images exceeding the API limit (5MB per image), rather than ingesting a 120MB base64 payload. Oversized or not, a single pasted image should never cause unbounded memory growth (~190GB footprint, ~1,500+ retained copies of the same string) that exhausts RAM and swap and kernel-panics the machine. The extension also should not write the full 120MB payload as a single output-channel log line.
Error Messages/Logs
Kernel panic (x3 on 2026-07-06, at 16:15, 16:29, 17:31 BST): panic(cpu 10 caller 0xfffffe0051b4ca4c): watchdog timeout: no checkins from watchdogd in 94 seconds (355 total checkins since monitoring last enabled)
JetsamEvent-2026-07-06-170817.ips (memoryStatus): compressorSize: 1494235 pages, uncompressed: 11603169 pages (~190GB @ 16KB/page) largestZone: compressor_segment
node_2026-07-06-170603 resource diag (extension-spawned node, coalition com.microsoft.VSCode): Writes: 2147.49 MB of file backed memory dirtied over 2164 seconds (992.47 KB per second average), exceeding limit of 24.86 KB per second
Extension log (Claude VSCode.1.log): final entry at 16:44:59 is a single 120,078,654-byte line — "Received message from webview" containing one pasted image as base64 (120,078,196 chars ≈ 90MB PNG, 5712x4284 px). No further log output until the system died. Full files in attached zip.
Steps to Reproduce
- macOS, 64GB RAM, VS Code 1.127.0 with Claude Code extension 2.1.201, Opus 4.8
- Take a full-screen screenshot on a Retina display showing photo-heavy content
(mine was 5712x4284; the PNG was ~90MB because photographic content defeats
PNG compression)
- Paste it into the Claude Code extension chat panel with a short prompt and send
- Watch the VS Code process group in Activity Monitor: memory grows ~GB/minute,
extension logging stops, and within ~20-60 minutes the machine watchdog-panics
(repeated 3x in one day — VS Code restores the session after reboot, and
retrying the conversation re-triggers the crash)
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.201 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_