[BUG] Error: EMFILE: too many open files

Resolved 💬 2 comments Opened Nov 6, 2025 by egarson Closed Nov 6, 2025

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?

When I initially installed claude, it started up without any errors. I then added a marketplace /plugin marketplace add wshobson/agents and a single plugin code-refactoring from that repository (and before you shoot the messenger, I don't believe the error is related to that particular (very popular) plug-in).

When I re-started claude, I immediately got the following error (redacted; full error in section below):

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: EMFILE: too many open files, watch '/home/edward/.claude/settings.json'
    at FSWatcher.<computed> (node:internal/fs/watchers:254:19)
    at watch (node:fs:2549:36)
[SNIP]

Claude then responds with:

Thank you! This is critical information. The error shows that Claude Code itself is failing to watch
  /home/edward/.claude/settings.json because the process has exhausted file watchers/descriptors.

  This is a bug in Claude Code - it has accumulated 757,812 open file descriptors, likely from file watchers that were  never cleaned up. This isn't something you can fix with .claudeignore.

Next, I disabled the plugin to eliminate it from the potential cause:

➜  proj git:(master) ✗ cat ~/.claude/settings.json
{
  "enabledPlugins": {
    "code-refactoring@claude-code-workflows": false
  },
  "alwaysThinkingEnabled": false
}

Because I have a project with many files, I created a .claudeignore file in both the sub-project in which I wanted claude to do some work, and additionally in the parent directory (project top-level). I was careful to create both .claudignore files with entries relative to the project sub-directory to no avail.

However, the error persists even with a tiny project: I created an empty directory and added a single 4-line file to it and started claude and it resulted in the same behavior.

Thank you for creating claude code. Having used in via copilot successfully for some time, I am now using it directly with a fresh new subscription, but I am now unable to start it without the above error message, which disturbs my psychic vibrations.

What Should Happen?

Claude should start up successfully with no error.

Error Messages/Logs

This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: EMFILE: too many open files, watch '/home/edward/.claude/settings.json'
    at FSWatcher.<computed> (node:internal/fs/watchers:254:19)
    at watch (node:fs:2549:36)
    at d_0 (file:///home/edward/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:280:13929)
    at al9 (file:///home/edward/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:280:19090)
    at nZ1._watchWithNodeFs (file:///home/edward/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:280:14410)
    at nZ1._handleFile (file:///home/edward/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:280:15136)
    at nZ1._addToNodeFs (file:///home/edward/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:280:18144)
    at async file:///home/edward/.nvm/versions/node/v22.20.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:280:26970
    at async Promise.all (index 0)

Steps to Reproduce

  1. Add this marketplace: /plugin marketplace add wshobson/agents
  2. Install the code-refactoring plugins from it
  3. Re-start claude
  4. Open up a large project
  5. Potentially witness the error I get
  6. Disable the plugin
  7. Re-start claude in a tiny project
  8. Potentially witness the error I get

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.34 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

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