[BUG]
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?
In situations where Claude edits an existing function's args and they are indented-in due to the number of arguments, Claude often forgets a comma before the newline and indent. This has happened across models for the last few months and in the most recent. At least recently, it has only happened with functions passed to returns.
return foo(
arg1=arg1,
arg2=arg2,
arg3=arg3
arg4=arg4,
)
This leads to the same error every time of course: SyntaxError: invalid syntax. Perhaps you forgot a comma?
What Should Happen?
return foo(
arg1=arg1,
arg2=arg2,
arg3=arg3,
arg4=arg4,
)
And no syntax error.
Error Messages/Logs
SyntaxError: invalid syntax. Perhaps you forgot a comma?
Steps to Reproduce
prompt Claude to edit a function with multiple arguments, by modifying one of the arguments. Nondeterministic so may not happen every time, but happens to me multiple times a session when it happens.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
can't screenshot, proprietary code.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗