VS Code extension hangs when pasting image that exceeds 5MB API limit

Resolved 💬 4 comments Opened Mar 22, 2026 by marcenggist Closed Apr 21, 2026

Description

When pasting a large image (e.g. a high-resolution screenshot) into the Claude Code VS Code extension chat input, the extension hangs indefinitely if the base64-encoded image exceeds the 5MB API limit.

No error message is shown — the UI just freezes/hangs, requiring the user to cancel or restart the conversation.

Expected behavior

The extension should either:

  1. Auto-resize/compress the image to fit within the API limit before sending
  2. Show a clear error message like "Image too large (5.7MB). Maximum is 5MB. Please resize and try again." — and allow the user to continue the conversation

Actual behavior

The extension hangs silently. The only indication is an error in the response: Image base64 size (5.7MB) exceeds API limit (5MB) — but by that point the conversation is stuck.

Steps to reproduce

  1. Take a full-screen screenshot on a high-resolution display (e.g. 1920x1200+)
  2. Copy it to clipboard
  3. Paste into the Claude Code VS Code extension chat input
  4. Send the message
  5. Extension hangs

Environment

  • VS Code on Windows 11
  • Claude Code VS Code extension (latest)
  • Display: high-resolution (screenshots easily exceed 5MB)

Suggested fix

Client-side image compression before sending to the API would be the best UX. Libraries like sharp or canvas-based resize could bring any pasted image under the limit transparently. Failing that, a pre-flight size check with a user-friendly error message would be sufficient.

View original on GitHub ↗

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