[BUG] Error 400 "invalid high surrogate in string" when loading UTF-8 files with emojis via MCP tools

Resolved 💬 3 comments Opened Nov 28, 2025 by HealthingMkt Closed Dec 2, 2025

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?

Versão: Claude Code v2.0.54
Comportamento: Claude Code falha com erro 400 ao serializar arquivos UTF-8 válidos contendo emojis para JSON ao enviar para a API.
Erro:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"invalid high surrogate in string: line 1 column 19014 (char 19013)"}

What Should Happen?

Arquivos .md com emojis (🚀, 📊, ✅, etc.) que são carregados automaticamente via MCP tools
Arquivos estão com encoding UTF-8 válido (confirmado via file e xxd)
Funcionava normalmente até a atualização recente (2025-11-26)
Problema ocorre tanto com modelo Opus 4.5 quanto Sonnet 4.5

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"invalid high surrogate in string: line 1 column 19014 (char 19013)"}

Steps to Reproduce

Reprodução:

Criar arquivo .md com emojis em UTF-8 válido
Configurar MCP server que lê esse arquivo
Iniciar Claude Code e chamar a tool que lê o arquivo
Erro 400 "invalid high surrogate"

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.54

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

_No response_

View original on GitHub ↗

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