[BUG] Valid PNG images downloaded from GitHub issues cause 'Could not process image' error
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?
When Claude Code downloads images from GitHub issues (using curl -H "Authorization: token $(gh auth token)" -L <github-user-attachments-url> -o /tmp/image.png) and then reads them, the API returns:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CYGr43WyuVAqgB7dgAb76"}
The images are completely valid. Diagnostic output confirms:
File: /tmp/current_apk.png
Size: 75K (76285 bytes)
File type: PNG image data, 1599x186, 8-bit/color RGB, non-interlaced
MIME type: image/png
PNG signature: VALID (89504e470d0a1a0a)
PNG IEND chunk: PRESENT (file is complete, not truncated)
Fully decodable: YES (ImageMagick identify succeeds)
The same images display correctly in browsers, image viewers, and can be uploaded to claude.ai web interface without issues.
Two Distinct Problems
Problem 1: Valid images rejected by API
The Claude API rejects valid PNG files downloaded from GitHub. This happens consistently with user-attachments URLs from GitHub issues. The images are not corrupted — they pass all validation checks (valid PNG signature, valid IEND chunk, reasonable size, standard 8-bit RGB format).
Problem 2: Session poisoning (shared with #19031, #4083)
Once the error occurs, the failed image data stays in the conversation context and every subsequent message fails with the same error, making the entire session unusable. The only workaround is /clear or restarting.
What Should Happen?
- Valid PNG images should be processed successfully
- If an image fails to process, it should be gracefully removed from context so the session remains usable
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Could not process image"},"request_id":"req_011CYGr43WyuVAqgB7dgAb76"}
Steps to Reproduce
- Open a GitHub issue that contains attached images (e.g., screenshots)
- Ask Claude Code to investigate the issue — it will download images via:
``bash``
curl -H "Authorization: token $(gh auth token)" -L "https://github.com/user-attachments/assets/<uuid>" -o /tmp/image.png
- Claude Code attempts to read the downloaded image using the Read tool
- API returns 400 "Could not process image"
- All subsequent messages in the session also fail
Diagnostic Evidence
Full diagnostic script output proving the image is valid:
=== Image Diagnostic Report ===
File: /tmp/current_apk.png
Size: 75K (76285 bytes)
File type (file command): PNG image data, 1599 x 186, 8-bit/color RGB, non-interlaced
MIME type: image/png
MIME encoding: binary
First 16 bytes (hex):
00000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452 .PNG........IHDR
PNG signature check:
Expected: 89504e470d0a1a0a
Actual: 89504e470d0a1a0a
Result: VALID PNG signature
Image details (ImageMagick):
Format: PNG
Geometry: 1599x186+0+0
Colorspace: sRGB
Type: TrueColor
Depth: 8-bit
File integrity:
Last 12 bytes: 0000 0000 4945 4e44 ae42 6082 (....IEND.B`.)
PNG IEND chunk: PRESENT (file appears complete)
Context
This is a common workflow: Claude Code is asked to investigate GitHub issues, which often contain screenshot attachments. The CLAUDE.md instructions in our project even document downloading images from issues:
curl -H "Authorization: token $(gh auth token)" -L <image-url> -o image.png
This workflow is essentially broken because Claude Code cannot process the downloaded images.
Related Issues
- #19031 — Session poisoning from corrupted images (our Problem 2 is the same, but Problem 1 is different — our images are valid)
- #4083 — Image Processing Failure: API Rejects Unrelated Context Image
- #25617 — macOS native screenshots fail (similar — valid images rejected)
- #12616, #22351 — Other "Could not process image" reports
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Latest (Feb 2026)
Platform
Anthropic API (direct)
Operating System
Linux (Ubuntu 24.04, kernel 6.8.0-90-generic)
Terminal/Shell
bash
Additional Information
The diagnostic script used to verify image integrity is available at: https://gist.github.com — happy to share if needed. The script checks PNG signature, IEND chunk, file type, MIME type, dimensions, and decodability without Claude Code reading the image (which would break the session).
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗