Description
Steps to reproduce
- Run
sudo sysctl -w fs.inotify.max_user_instances=16 or some other lower number
- Run
opencode in a path that contains a .git directory.
Expected behavior
Opencode starts normally. Or, if it really can't work without a lot of inotify instances, then it should show a clear error message and exit.
Actual behavior
Opencode hangs at startup with a blank screen, completely unresponsive.
Likely root cause
Opencode doesn't handle the error "EMFILE (Too many open files)" when creating new inotify instances.
Workaround
Increase the systemwide limit of inotify user instances: sudo sysctl -w fs.inotify.max_user_instances=2048
Log
Last log lines from where it hangs:
$ opencode run hello --print-logs
[...]
INFO 2026-03-08T15:39:44 +2ms service=server method=GET path=/event request
INFO 2026-03-08T15:39:44 +0ms service=server status=started method=GET path=/event request
INFO 2026-03-08T15:39:44 +0ms service=server method=POST path=/session/ses_331e54564ffeUxW4QHflpXACOJ/message request
INFO 2026-03-08T15:39:44 +0ms service=server status=started method=POST path=/session/ses_331e54564ffeUxW4QHflpXACOJ/message request
INFO 2026-03-08T15:39:44 +0ms service=server event connected
INFO 2026-03-08T15:39:44 +1ms service=bus type=* subscribing
INFO 2026-03-08T15:39:44 +5ms service=server status=completed duration=6 method=GET path=/event request
INFO 2026-03-08T15:39:44 +1ms service=server status=completed duration=7 method=POST path=/session/ses_331e54564ffeUxW4QHflpXACOJ/message request
INFO 2026-03-08T15:39:44 +3ms service=vcs branch=HEAD initialized
INFO 2026-03-08T15:39:44 +0ms service=bus type=file.watcher.updated subscribing
^C
Plugins
None. The same issue happens when I disable all plugins.
OpenCode version
1.2.21
Steps to reproduce
- Run
sudo sysctl -w fs.inotify.max_user_instances=16 or some other lower number
- Run
opencode in a path that contains a .git directory.
Screenshot and/or share link
No response
Operating System
Ubuntu 24.04, Alpine 3.23
Terminal
bash
Description
Steps to reproduce
sudo sysctl -w fs.inotify.max_user_instances=16or some other lower numberopencodein a path that contains a.gitdirectory.Expected behavior
Opencode starts normally. Or, if it really can't work without a lot of inotify instances, then it should show a clear error message and exit.
Actual behavior
Opencode hangs at startup with a blank screen, completely unresponsive.
Likely root cause
Opencode doesn't handle the error "EMFILE (Too many open files)" when creating new inotify instances.
Workaround
Increase the systemwide limit of inotify user instances:
sudo sysctl -w fs.inotify.max_user_instances=2048Log
Last log lines from where it hangs:
Plugins
None. The same issue happens when I disable all plugins.
OpenCode version
1.2.21
Steps to reproduce
sudo sysctl -w fs.inotify.max_user_instances=16or some other lower numberopencodein a path that contains a.gitdirectory.Screenshot and/or share link
No response
Operating System
Ubuntu 24.04, Alpine 3.23
Terminal
bash