[BUG] High token usage: schema validation error loads massive JSON into context and consume about 26k tokens
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?
Problem
During a simple ~/.claude/settings.json edit session, a validation error caused the full JSON schema (~2500 lines) to be loaded into context, resulting in a high weekly token consumption for a single file edit operation.
The entire JSON schema is included in the error response and loaded into the conversation context, consuming a disproportionate amount of tokens for a simple edit operation.
What Should Happen?
Validation error should return a short, human-readable message pointing to the specific invalid field.
Error Messages/Logs
Steps to Reproduce
- Edit
~/.claude/settings.jsonvia Claude Code - Make an edit that triggers schema validation (e.g. leaving an empty
envobject after removing a key) - The full JSON schema is dumped into the error message and loaded into context
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.92
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Claude DevTools:
<img width="988" height="926" alt="Image" src="https://github.com/user-attachments/assets/67b8df84-4a0e-49df-91d7-fc3c2a895733" />
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗