[BUG] Claude Code repeatedly generates invalid tool invocations

Resolved 💬 5 comments Opened May 4, 2026 by neilweber Closed Jun 2, 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?

I often see Claude Code generate an invalid tool invocation, fix it, and then sometime later make the same mistake. For example, CC has generated the following tool invocation twice this morning:

Bash(flutter analyze --no-pub 2>&1 | grep -E "error|warning" | grep -v "test\\")

It fails with this error message: grep: Trailing backslash

And then CC fixes the error with this:

Bash(flutter analyze --no-pub 2>&1 | grep -E "^error")

This is one obvious example but I've seen others. I'll try to document them here too.

What Should Happen?

Claude should not generate invalid tool invocations. And if it does, it should not does so multiple times.

Error Messages/Logs

Steps to Reproduce

I have no idea how to reproduce this other than having CC make a change to a Flutter project.

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

v2.1.126

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗