[Bug] Unhandled API Error when Read tool processes non-image files with image extensions
Resolved 💬 3 comments Opened Jan 1, 2026 by bradfeld Closed Jan 5, 2026
Bug Description
Summary: Claude Code crashes with "Could not process image" when Read tool is given an HTML file disguised as an image
Steps to reproduce:
- Download a URL that returns HTML (e.g., an auth-protected image URL that returns login page)
- Save it as a .png file
- Use the Read tool to view the "image"
- Claude Code crashes instead of handling the API 400 error gracefully
Error message:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CWhVUp5ztioeseSNBCtHD"}
Expected behavior:
Claude Code should catch the API error and display a user-friendly message like "File is not a valid image" rather than crashing.
Context:
- Occurred when /linear-image skill tried to view a Marker.io image that required authentication
- Marker.io returned HTML login page instead of the actual image
- File was saved as .png but contained HTML content
- Claude Code version: 2.0.76
- Session: 5baf32ee-0ade-498b-a275-98f0d64a5cce
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 2.0.76
- Feedback ID: f07e894b-ec84-4313-b098-58f2879da820
Errors
[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/bfeld/.local/share/claude/versions/2.0.76 (expected in multi-process scenarios)\n at XZR (/$bunfs/root/claude:2430:2165)\n at fUA (/$bunfs/root/claude:2430:1885)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-01-01T23:06:20.888Z"}]This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗