[BUG] Startup crash in Docker: ENOSPC from settings file watcher
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?
Starting claude in a Dockerized environment crashes on startup because the CLI tries to watch config files in both $HOME and the current project. In containers with low/immutable inotify limits, this throws ENOSPC and exits instead of degrading gracefully.
What Should Happen?
claude should start normally. If file watching for settings cannot be established, it should warn and continue without hot-reload of config (or use a safe fallback like polling), not crash.
Error Messages/Logs
node:internal/fs/watchers:254
const error = new UVException({
^
Error: ENOSPC: System limit for number of file watchers reached, watch '~/.claude/settings.local.json'
at FSWatcher.<computed> (node:internal/fs/watchers:254:19)
at watch (node:fs:2539:36)
at L$A (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:7030)
at oC9 (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:7364)
at A10._watchWithNodeFs (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:8774)
at A10._handleFile (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:9500)
at A10._addToNodeFs (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:12508)
at async file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:17276
at async Promise.all (index 0)
Emitted 'error' event on Z10 instance at:
at Z10._handleError (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:19822)
at A10._addToNodeFs (file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:12605)
at async file:///usr/lib/node_modules/@anthropic-ai/claude-code/cli.js:784:17276
at async Promise.all (index 0) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '~/.claude/settings.local.json',
filename: '~/.claude/settings.local.json'
}
Node.js v24.7.0
Steps to Reproduce
- In a Docker container with a low/unchangeable inotify limit (common in shared or restricted environments), ensure
the project has .claude/settings.local.json (and/or a settings file under $HOME).
- Run claude from that project directory.
- Observe immediate startup failure with ENOSPC.
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
1.0.110 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Workaround
- Deleting the settings file(s) lets claude start successfully. This is a bit heavy-handed but confirms watching
config files is non-essential to core function.
Impact
- Blocks use in constrained containers, remote dev workspaces, and some CI images where raising inotify limits is
not possible.
Proposed Fix
- Catch ENOSPC from file watching and continue:
- Log a clear warning and run without config hot-reload.
- Provide --no-config-watch and/or CLAUDE_DISABLE_CONFIG_WATCH=1.
- Optionally fallback to a low-cost polling strategy (or disable watching entirely in Docker if desired).
- Reduce watcher footprint if both $HOME and project config are watched; dedupe and defer watchers until after startup
so an error can be handled non-fatally.
Additional Context
- In many Docker and shared storage setups, increasing fs.inotify.max_user_watches is not feasible. A graceful
degradation path would make claude robust in these environments.
10 Comments
It happened to me without any docker. I am using claude without adding settings of my own in a primitive way on Ubuntu 24.04.03. It is not new, happened several weeks ago once.
Workaround: remove
.claudedirectory in the local project I am working with.(Increasing the allowed number of files for operating system, e.g. 2x or more, did not help.)
I am facing this also. I do not know exactly when it started since I have been using another CLI for the past few weeks. I do all of my agentic development in docker (podman) containers and claude will not start. I've tried rebuilding the container. That's probably what triggered it in the first place (claude upgrade).
This occurs as long as ~/.claude/settings.json exists, even if it is empty. Fortunately I do not use it so I can remove the file before starting claude.
@goxq Hello, I am currently experiencing this issue as well—an error within Docker. Do you have any other mitigation solutions? i need add hooks at PostUseTool Write|Edit
ye,it works well for me, too. Just remove /root/.claude folder, but it will drop the history
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Confirming on v2.1.2, non-Docker, Pop!_OS (Linux 6.17.4-76061704-generic), Node.js v22.21.1.
Both
claudeandclaude updatecrash immediately with multiple ENOSPC errors:Watchers fail on:
~/.claude,~/.claude/.credentials.json,~/.claude/CLAUDE.md,~/.claude/settings.json,~/.claude/skills/, project.claude/settings.local.json, etc.Welcome screen partially renders before crash — watchers seem to init late in startup.
Workaround:
sudo sysctl fs.inotify.max_user_watches=524288+1 for
--no-config-watch/CLAUDE_DISABLE_CONFIG_WATCH=1.This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.