[BUG] compaction with paths to corrupted images fails

Resolved 💬 3 comments Opened Mar 18, 2026 by marwinsteiner Closed Apr 28, 2026

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?

I have a path to a corrupted image in my chat with claude code and this results in the error:

Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.95.content.1.image.source.base64:
      image cannot be empty"},"request_id":"req_011CZAx7NnqbAPLBTJ2YwTnG"}

What Should Happen?

Compaction should succeed regardless if there are corrupted images in context.

Check if images are corrupted first, if they are, remove those images from context and proceed to compaction as normal.

Error Messages/Logs

Steps to Reproduce

  1. Insert a broken image into a chat like the attached one.
  2. You will get the error as pasted above when you try to /compact.

<!-- Failed to upload "Screenshot 2026-03-18 173451.png" -->

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.76 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

IntelliJ IDEA terminal

Additional Information

_No response_

View original on GitHub ↗

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