[BUG] EPERM: operation not permitted for .jsonl file

Resolved 💬 2 comments Opened Jul 13, 2025 by alvincrespo Closed Jul 19, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.51
  • Operating System: macOS 15.5 (24F74)
  • Terminal: VSCode Terminal

Bug Description

After working with Claude for a while in VSCode, I get this issue:

Claude configuration file not found at: /Users/toodarth/.claude.json
A backup file exists at: /Users/toodarth/.claude.json.backup
You can manually restore it by running: cp "/Users/toodarth/.claude.json.backup" "/Users/toodarth/.claude.json"

node:fs:2410
    return binding.writeFileUtf8(
                   ^

Error: EPERM: operation not permitted, open '/Users/toodarth/.claude/projects/-Users-toodarth-workspace-gaming-achievement-system/f3cdcb5e-9cee-4b6e-9a33-9fd5362c70f3.jsonl'
    at Object.writeFileSync (node:fs:2410:20)
    at Module.appendFileSync (node:fs:2492:6)
    at Object.appendFileSync (file:///Users/toodarth/.nvm/versions/node/v24.4.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:578:65509)
    at Bw0.appendEntry (file:///Users/toodarth/.nvm/versions/node/v24.4.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:626:45)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Bw0.insertMessageChain (file:///Users/toodarth/.nvm/versions/node/v24.4.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:624:31143)
    at async oF1 (file:///Users/toodarth/.nvm/versions/node/v24.4.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:627:1903) {
  errno: -1,
  code: 'EPERM',
  syscall: 'open',
  path: '/Users/toodarth/.claude/projects/-Users-toodarth-workspace-gaming-achievement-system/f3cdcb5e-9cee-4b6e-9a33-9fd5362c70f3.jsonl'
}

Steps to Reproduce

  1. Open a simple project with Claude Code
  2. Work with it for a while
  3. I get the above error, and Claude exits

Expected Behavior

I expect the session to just continue, not crash.

Actual Behavior

The session crashes and I have to restart Claude.

Additional Context

✗ ls -la ~/.claude
total 0
drwxr-xr-x    7 toodarth  staff   224 Jul 11 20:42 .
drwxr-x---+ 116 toodarth  staff  3712 Jul 13 14:18 ..
drwxr-xr-x    4 toodarth  staff   128 Jul 11 21:23 ide
drwxr-xr-x    4 toodarth  staff   128 Jul 11 21:20 projects
drwxr-xr-x    3 toodarth  staff    96 Jul 10 14:57 shell-snapshots
drwxr-xr-x    6 toodarth  staff   192 Jul 10 14:56 statsig
drwxr-xr-x   13 toodarth  staff   416 Jul 13 14:07 todos
➜  .claude git:(main) ✗ ls -la ~/.claude/projects
total 0
drwxr-xr-x   4 toodarth  staff  128 Jul 12 06:38 -Users-toodarth-workspace-gaming-achievement-system
drwxr-xr-x  10 toodarth  staff  320 Jul 11 20:15 -Users-toodarth-workspace-jardim-app
drwxr-xr-x   4 toodarth  staff  128 Jul 11 21:20 .
drwxr-xr-x   7 toodarth  staff  224 Jul 11 20:42 ..
➜  .claude git:(main) ✗ ls -la ~/.claude/projects/-Users-toodarth-workspace-gaming-achievement-system
total 816
drwxr-xr-x  4 toodarth  staff     128 Jul 12 06:38 .
drwxr-xr-x  4 toodarth  staff     128 Jul 11 21:20 ..
-rw-r--r--  1 toodarth  staff  202372 Jul 11 21:23 8dcfed33-1b10-44e3-ae80-93233e8cb6e4.jsonl
-rw-r--r--  1 toodarth  staff  197613 Jul 13 14:07 f3cdcb5e-9cee-4b6e-9a33-9fd5362c70f3.jsonl
➜  node --version
v24.4.0
➜  which node
/Users/toodarth/.nvm/versions/node/v24.4.0/bin/node

Worked with Claude desktop to debug and went through multiple checks and eventually landed on this:

This suggests the EPERM error is likely a race condition or timing issue within Claude Code itself - it might be trying to write to the file while another part of the process is already writing to it.
The fact that manual writes work fine suggests this is a concurrency issue within Claude Code rather than a true permissions problem.

Here are some of the checks:

✗ lsof "/Users/toodarth/.claude/projects/-Users-toodarth-workspace-gaming-achievement-system/f3cdcb5e-9cee-4b6e-9a33-9fd5362c70f3.jsonl"
✗ df -h /Users/toodarth/.claude/
Filesystem      Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk3s5   1.8Ti   297Gi   1.5Ti    17%    3.4M   16G    0%   /System/Volumes/Data
✗ echo "test" >> "/Users/toodarth/.claude/projects/-Users-toodarth-workspace-gaming-achievement-system/f3cdcb5e-9cee-4b6e-9a33-9fd5362c70f3.jsonl"
✗ 

View original on GitHub ↗

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