[Bug] Anthropic API Error: Image exceeds 5 MB maximum causes persistent message state corruption
Bug Description
When Claude tries to open an image that larger that 5mb, it errors out with the following error:
Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.30.content.0.tool_result.content.0.image.source.base64: image
exceeds 5 MB maximum: 5577016 bytes > 5242880 bytes"},"request_id":"req_011CVPs4RgUBL3LkQnMmiiXe"}
After this error, any consecutive prompt to Claude results in the same error over and over.
Example:
⎿ Read image (4MB)
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.30.content.0.tool_result.content.0.image.source.base64:
image exceeds 5 MB maximum: 5577016 bytes > 5242880 bytes"},"request_id":"req_011CVPs4RgUBL3LkQnMmiiXe"}
downsamplke the file
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.30.content.0.tool_result.content.0.image.source.base64:
image exceeds 5 MB maximum: 5577016 bytes > 5242880 bytes"},"request_id":"req_011CVPs5o9ajBB9dZ6jwjuFN"}
/context
⎿ Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.30.content.0.tool_result.content.0.image.source.base64: image
exceeds 5 MB maximum: 5577016 bytes > 5242880 bytes"},"request_id":"req_011CVPs6gZEESaWLVW9nnzC8"}
Environment Info
- Platform: win32
- Terminal: zed
- Version: 2.0.50
- Feedback ID: a52301e6-4a5b-426f-837f-4378db98f4bf
Errors
[{"error":"Error: Could not load the \"sharp\" module using the win32-x64 runtime\nPossible solutions:\n- Ensure optional dependencies can be installed:\n npm install --include=optional sharp\n- Ensure your package manager supports multi-platform installation:\n See https://sharp.pixelplumbing.com/install#cross-platform\n- Add platform-specific dependencies:\n npm install --os=win32 --cpu=x64 sharp\n- Consult the installation documentation:\n See https://sharp.pixelplumbing.com/install\n at <anonymous> (B:/~BUN/root/claude.exe:832:36230)\n at <anonymous> (B:/~BUN/root/claude.exe:11:356)\n at <anonymous> (B:/~BUN/root/claude.exe:833:88)\n at <anonymous> (B:/~BUN/root/claude.exe:11:356)\n at <anonymous> (B:/~BUN/root/claude.exe:833:79804)\n at <anonymous> (B:/~BUN/root/claude.exe:11:356)\n at <anonymous> (B:/~BUN/root/claude.exe:833:79980)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-11-23T00:13:14.117Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.252.content.0.image.source.base64: image exceeds 5 MB maximum: 5577016 bytes > 5242880 bytes\"},\"request_id\":\"req_011CVPrYaBrLUYcbzrDteECE\"}\n at generate (B:/~BUN/root/claude.exe:350:36489)\n at makeRequest (B:/~BUN/root/claude.exe:1256:5434)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-11-23T00:13:38.149Z"},{"error":"TypeError: (L.default||L) is not a function. (In '(L.default||L)(H)', '(L.default||L)' is an instance of Object)\n at v8H (B:/~BUN/root/claude.exe:833:80003)\n at async s7I (B:/~BUN/root/claude.exe:833:86218)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-11-23T00:14:58.508Z"},{"error":"TypeError: (L.default||L) is not a function. (In '(L.default||L)(H)', '(L.default||L)' is an instance of Object)\n at v8H (B:/~BUN/root/claude.exe:833:80003)\n at async s7I (B:/~BUN/root/claude.exe:833:86218)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-11-23T00:15:37.213Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.252.content.0.image.source.base64: image exceeds 5 MB maximum: 5577016 bytes > 5242880 bytes\"},\"request_id\":\"req_011CVPrioxMpyqRMgLUmh5Ht\"}\n at generate (B:/~BUN/root/claude.exe:350:36489)\n at makeRequest (B:/~BUN/root/claude.exe:1256:5434)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-11-23T00:15:57.050Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.252.content.0.image.source.base64: image exceeds 5 MB maximum: 5577016 bytes > 5242880 bytes\"},\"request_id\":\"req_011CVPrnh5ygTQRHaTYvtLka\"}\n at generate (B:/~BUN/root/claude.exe:350:36489)\n at makeRequest (B:/~BUN/root/claude.exe:1256:5434)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-11-23T00:16:49.705Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.252.content.0.image.source.base64: image exceeds 5 MB maximum: 5577016 bytes > 5242880 bytes\"},\"request_id\":\"req_011CVPrpM6VwRK3KCXk98tMQ\"}\n at generate (B:/~BUN/root/claude.exe:350:36489)\n at makeRequest (B:/~BUN/root/claude.exe:1256
Note: Error logs were truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗