API Error 400: surrogates not allowed when attaching screenshot via file picker (VSCode extension, Windows)
Open 💬 0 comments Opened Jul 6, 2026 by LisaKretzschmar
Environment: VSCode extension, Windows 11
Steps to reproduce:
- In a Claude Code chat in VSCode, attach a screenshot via the file picker (Save as PNG → attach file)
- Submit the message
Expected: Message sends successfully
Actual: API Error 400 returned:
{"type":"error","error":{"type":"invalid_request_error","message":"The request body is not valid JSON: str is not valid UTF-8: surrogates not allowed: line 1 column 1 (char 0)"}}
Note: The image does appear to reach Claude despite the error — Claude can read and respond to the screenshot content. The error may be a false positive or from a prior failed attempt, but it appears consistently.