claude-code - 💡(How to fix) Fix [BUG] Claude commands fail with EACCES permission denied error when creating files [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49137Fetched 2026-04-17 08:49:50
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Error Message

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)

Code Example

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)
RAW_BUFFERClick to expand / collapse

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

extent analysis

TL;DR

The most likely fix is to check and adjust the file system permissions for the project directory to ensure the Claude Code process has write access.

Guidance

  • Verify the ownership and permissions of the project directory and its contents using ls -l to check if the user running the Claude command has write permissions.
  • Check if the issue persists when running the Claude command with elevated privileges using sudo to isolate if it's a permission issue.
  • Review the differences in file system permissions between the last working version (1.0.100) and the current version (1.0.123) to identify any changes that might be causing the issue.
  • Consider resetting the permissions of the project directory to a more permissive state (e.g., chmod -R 755 my-project) to test if it resolves the issue.

Example

No specific code snippet is applicable in this case, as the issue seems related to file system permissions rather than code.

Notes

The fact that this is identified as a regression and worked in a previous version (1.0.100) suggests that a change in the Claude Code version might be the cause, potentially related to how file system interactions are handled.

Recommendation

Apply a workaround by adjusting the file system permissions to ensure the Claude Code process has the necessary write access, as the root cause seems to be related to permissions rather than a bug in the code itself.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Claude commands fail with EACCES permission denied error when creating files [1 participants]