[BUG] Image attachment causing UTF-8 surrogate error
Open 💬 2 comments Opened Jul 2, 2026 by ArpanDeloitte
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?
Windows 11
Version 2.1.197
Image attachment causing UTF-8 surrogate error
Plain text works but images do not
<img width="889" height="485" alt="Image" src="https://github.com/user-attachments/assets/177c4981-3c7f-4b2a-82b4-a8f5abb64873" />
What Should Happen?
when ever I am attaching an image it is showing me error as 'API Error: 400 The request body is not valid JSON: str is not valid UTF-8: surrogates not allowed: line 1 column 1 (char 0)' in Claude code. After explaining it is not able to resolve the issue only image is working in my complex project.
Error Messages/Logs
API Error: 400 The request body is not valid JSON: str is not valid UTF-8: surrogates not allowed: line 1 column 1 (char 0)
Steps to Reproduce
include any image in claude code.
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
2.1.187
Claude Code Version
2.1.197
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗