[BUG] Claude Code CLI returns blank output for --json-schema
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?
When submitting any non-interactive prompt with --json-schema flag, the model appears to call the structured output tool, but the CLI never returns the output.
To reproduce:
claude -p --model sonnet --json-schema '{"type":"object","properties":{"color":{"type":"string"},"count":{"type":"number"}},"required":["color","count"]}' "How many legs does a cat have? Reply with the color of the sky and the number of legs."
Returns zero output.
Transcript from the above query (generated via claude-devtools):
---
Session Export
| Property | Value |
|----------|-------|
| Session | c2a9bad2-78a3-4cb3-96b0-2460816b159a |
| Project | /Users/shXXXXXXXXXXXXXXXXXXXXXXXXX |
| Branch | main |
| Date | 2026-03-19 03:04:16 UTC |
Metrics
| Metric | Value |
|--------|-------|
| Duration | 3s |
| Total Tokens | 31,987 |
| Input Tokens | 3 |
| Output Tokens | 71 |
| Cache Read | 6,341 |
| Cache Created | 25,572 |
| Messages | 3 |
| Cost | N/A |
Conversation
User (Turn 1)
How many legs does a cat have? Reply with the color of the sky and the number of legs.
Assistant (Turn 2)
Tool: StructuredOutput
Input: {
"color": "blue",
"count": 4
}
Structured output provided successfully
Tool: StructuredOutput
{
"color": "blue",
"count": 4
}
Result:
Structured output provided successfully
What Should Happen?
Output for the above query should be:
{
"color": "blue",
"count": 4
}
Error Messages/Logs
Steps to Reproduce
Just run the following prompt:
claude -p --model sonnet --json-schema '{"type":"object","properties":{"color":{"type":"string"},"count":{"type":"number"}},"required":["color","count"]}' "How many legs does a cat have? Reply with the color of the sky and the number of legs."
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.79 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
<img width="836" height="327" alt="Image" src="https://github.com/user-attachments/assets/188ddc00-dffa-436e-961c-42943a37f1fc" />
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗