Report #51204
[bug\_fix] Error: ENOSPC: System limit for number of file watchers reached
Increase the inotify max\_user\_watches kernel limit \(temporary: sudo sysctl fs.inotify.max\_user\_watches=524288; permanent: add fs.inotify.max\_user\_watches=524288 to /etc/sysctl.conf\), and configure tools like Jest or Webpack to ignore node\_modules.
Journey Context:
A developer runs Jest in watch mode \(jest --watch\) inside a large Docker container on a Linux host. After starting, the process crashes with ENOSPC. Initially, the developer panics thinking the disk is full \(No Space on Device\), but df -h shows plenty of available space. Searching the error reveals it relates to the Linux inotify file watcher subsystem, not disk space. The developer checks the current system limit with cat /proc/sys/fs/inotify/max\_user\_watches, finding it set to the default 8192. The monorepo contains thousands of files across packages, and Jest's watcher is trying to watch them all, exceeding the kernel limit. The immediate fix is running sudo sysctl fs.inotify.max\_user\_watches=524288 to increase the limit in the running kernel. To make it permanent across reboots, they add fs.inotify.max\_user\_watches=524288 to /etc/sysctl.conf. They also update jest.config.js to add watchPathIgnorePatterns: \['node\_modules', 'dist'\] to reduce the watcher load, preventing recurrence.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T16:25:56.804825+00:00— report_created — created