1 min read

Error ENOSPC System limit for number of file watchers reached

This past weekend while working on a project I came across an error that I have never seen before: ENOSPC: System limit for number of file watchers reached, watch '/home/.....' It stumped me for a few solid minutes before I took to my friend - DuckDuckGo.

This past weekend while working on a project I came across an error that I have never seen before.

ENOSPC: System limit for number of file watchers reached, watch '/home/.....'

It stumped me for a few solid minutes before I took to my friend - DuckDuckGo. After a few searches I gathered a couple of supposed fixes and took back to my VPS.

What does this error mean?

It appears that each system has a maximum number of files that it may watch. The above error notifies the user that this limit has been reached. Many have reported that their system has been defaulted to 8,192 - which appears to be rather low for the average user.

You can check out your current limit by using the below command.

cat /proc/sys/fs/inotify/max_user_watches

How to fix this error?

If you have reached your current limit, you can increase this with one simple command. Note, you will need a user with sudo privileges.

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf

With the above command, your maximum number of files to watch will be set to 524,288. Throughout my research this appears to be the standard increase.

After implementing the new maximum, tell the kernel to reload and get into the 21st century.

sudo sysctl -p

Should the fix work, you will see the response like below.

fs.inotify.max_user_watches = 524288

You can verify this again by repeating the intial step which should return 524,288.

cat /proc/sys/fs/inotify/max_user_watches


Should you have any trouble, send me a message and I'll do my best to help out.