VS Code extension hangs when pasting image that exceeds 5MB API limit
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:
- Auto-resize/compress the image to fit within the API limit before sending
- 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
- Take a full-screen screenshot on a high-resolution display (e.g. 1920x1200+)
- Copy it to clipboard
- Paste into the Claude Code VS Code extension chat input
- Send the message
- 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.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗