[BUG] Unable to parse valid Python file during modification (Claude Code CLI)

Resolved 💬 1 comment Opened Apr 30, 2026 by Mithun017 Closed Jun 1, 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?

Claude Code fails to parse and modify a valid Python file and throws an error during execution.

Even with a minimal Python script that contains no syntax errors, the tool is unable to process the file after permission is granted.

This breaks basic workflows such as adding type hints or modifying files via CLI.

What Should Happen?

Claude Code should successfully read, parse, and modify the Python file without errors.

It should correctly apply the requested changes (e.g., adding type hints) and update the file.

Error Messages/Logs

Error: "Unable to parse file"

Additional context:
- Occurs after granting file access
- Happens during file modification tasks
- File is valid and contains no syntax errors

Steps to Reproduce

  1. Create a file test.py with the following content:

```python
def hello():
print("test")
2.Run:
claude "add type hints to test.py"
3.Accept file access permissions
4.Observe the error:
"Unable to parse file"

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Unknown

Claude Code Version

2.1.118

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

This issue impacts basic file editing workflows in Claude Code.

The failure occurs even with minimal and valid Python files, suggesting a potential issue with file parsing or CLI integration.

The problem is reproducible and does not depend on external dependencies, making it likely a core issue rather than environment-specific.

This significantly reduces reliability for development tasks.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗