[BUG] Claude
Resolved 💬 4 comments Opened Mar 10, 2026 by akrentsel Closed Apr 9, 2026
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 I run claude-code with a max number of turns, it sometimes ignores the max-turns and just runs for much longer.
What Should Happen?
Claude should respect the max_turns, not just ignore and blow past it.
Error Messages/Logs
See the attached log in the additional information section of the bug report, which shows us running very long, despite starting with max-turns being 100.
Steps to Reproduce
- Create a task.md file containing some (hard) task.
- Launch claude code in headless mode, with a max number of turns specified
claude -p "<entire TASK.md content>" \
--max-turns 100 \
--dangerously-skip-permissions \
--output-format stream-json \
--verbose \
--model claude-sonnet-4-6
- Watch it run for beyond 100 turns.
I cannot tell if this is because of compaction or something else – but compaction happened for us at turn ~67.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.72 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗