[BUG] Claude Code fabricate structured output files instead of preserving the real command failure
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?
Claude often recognized that the option/command was unsupported, but then continued anyway and wrote JSON outputs that looked like real success results.
In short: it knew the command path was invalid, but still produced "result" files as if the run succeeded.
What Should Happen?
Claude should stop at the real command failure and report that the option or command is unsupported. It should not fabricate structured output files that look like genuine command results.
Error Messages/Logs
Error: unsupported option / command path (for example unknown option such as --config or unsupported subcommand).
Observed bad behavior: despite this, Claude still wrote success-style JSON output artifacts.
Steps to Reproduce
- Open a repository workspace.
- Ask Claude to run a command that should fail, for example an unsupported flag path
- In the same request, require machine-readable output (for example
output/status.json). - Ask Claude to preserve the real command outcome and not fabricate fallback data.
- Check whether it still writes a success-style JSON artifact even though the command path was unsupported.
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.76
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
This was observed more than once across independent runs with different unsupported options/commands. The common failure mode is not a simple refusal or parse error; it is fabrication of machine-readable output after the tool has already identified that the requested command path is invalid.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗