[BUG] Model repeatedly generates wrong command after correctly stating the right one
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?
Description:
In a Claude Code session, I asked the model to run a remote SSH command that required cd-ing into a directory before running git pull. The model repeatedly stated the correct command in text, then generated a different (incorrect) command in the actual tool call — omitting the leading cd — across at
least 6 consecutive attempts, even after being shown the discrepancy explicitly.
Model: claude-sonnet-4-6
What Should Happen?
Expected behavior: The command in the tool call matches the command stated in text.
Error Messages/Logs
Actual behavior: The model generates the wrong command in the tool call even while correctly describing what it intends to do. Corrections do not stick within the session. The model apologizes and re-states the correct command, then generates the wrong one again.
Steps to Reproduce
Steps to reproduce:
- Ask Claude to run: ssh user@host 'cd /home/user/src/myrepo && git pull && cd /home/user/src/myrepo/src/subdir && uv sync --no-dev'
- Claude states in text: "I will run: ssh user@host 'cd /home/user/src/myrepo && git pull && ...'"
- Claude's actual Bash tool call contains: ssh user@host 'git pull && ...' — missing the leading cd
- Repeat steps 2–3 indefinitely regardless of correction
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.89 (Claude Code)
Platform
Anthropic API
Operating System
Other
Terminal/Shell
Other
Additional Information
FreeBSD 15.0, mate-terminal
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗