[BUG] Thinking messages not displayed in headless mode (-p flag) in 2.0.76 with OAuth
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?
Thinking blocks are not being generated when using -p (print/headless) mode, even though thinking is enabled and works correctly in interactive mode with the same model (Opus 4.5), when signed in using OAuth (did not test API key), using v2.0.76.
What Should Happen?
Session file should contain "type":"thinking" blocks, similar to interactive mode sessions.
Actual behavior:
- Interactive mode: Thinking blocks present ✓
-pmode: 0 thinking blocks ✗
Same model, same prompt, different behavior.
Error Messages/Logs
N/A
Steps to Reproduce
- Confirm thinking is enabled in interactive mode via
/config - Verify thinking works in interactive mode (establishes baseline):
``bash``
claude
# Then enter: "Tell me a funny original joke about debugging code"
# Exit and check the session file:
ls -lt ~/.claude/projects/<project-slug>/*.jsonl | head -1
grep -c '"type":"thinking"' <newest-session-file>
# Should return 1 or more
- Run the same prompt in
-pmode:
``bash``
claude -p "Tell me a funny original joke about debugging code"
- Check the session file for thinking blocks:
``bash``
ls -lt ~/.claude/projects/<project-slug>/*.jsonl | head -1
grep -c '"type":"thinking"' <newest-session-file>
# Returns 0
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
1.0.119
Claude Code Version
2.0.76 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
- Thinking works correctly in interactive CLI mode with the same prompts
- Previously reported as a bug between 1.0.58 and 1.0.119, reported here: https://github.com/anthropics/claude-code/issues/7840
- The changelog for 1.0.119 mentioned "Fix thinking mode not working in headless sessions" - this may be a regression
- Attempted workarounds that did not work:
--settings '{"thinkingMode": "enabled"}'--settings '{"thinking": {"enabled": true}}'--model opusexplicitly--betas extended-thinking(returns "Custom betas are only available for API key users")
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗