Skip to content

[BUG] Claude commands fail with EACCES permission denied error when creating files #49137

Description

@asperpharma

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When I run a Claude command like claude "create a new Python file" or claude "add type hints to test.py", Claude shows an error "EACCES: permission denied" and the file isn't created.

The command fails immediately after accepting the file write permission prompt. The error occurs consistently across multiple commands that involve file creation or modification.

What Should Happen?

Claude should execute the command successfully and create or modify the Python file without any permission errors. The file write operation should complete after the user accepts the permission prompt.

Error Messages/Logs

Error: EACCES: permission denied, open '/path/to/project/test.py'
    at Object.openSync (node:fs:601:3)
    at Object.writeFileSync (node:fs:2249:35)
    at ClaudeCode.writeFile (/usr/local/lib/node_modules/@anthropic-ai/claude-code/dist/index.js:123:10)
    at async ClaudeCode.executeCommand (/usr/local/lib/node_modules/@anthropic-ai/claude-code/dist/index.js:456:5)

Steps to Reproduce

  1. Create a new project directory: mkdir my-project && cd my-project
  2. Run a Claude command: claude "create a Python file called hello.py that prints Hello World"
  3. When prompted for file write access, accept/allow the permission
  4. Observe the error: "EACCES: permission denied"
  5. The file hello.py is not created in the directory

Note: This also happens with commands that modify existing files, e.g., claude "add type hints to existing_file.py"

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

1.0.100

Claude Code Version

1.0.123 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolsbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions