You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TUI hangs silently at startup when inotify instances are exhausted (still in 2.3.0, no .git needed) #64149
OpenCode 2.3.0 still hangs at startup with a blank screen when the user's inotify instances are exhausted (fs.inotify.max_user_instances). This is the same failure as #16610, which was closed automatically for inactivity rather than fixed. Two details differ from that report:
It happens without any .git directory: the working directory was an empty folder.
The hang is at the very first watcher, on the global config directory. The server logs watcher subscribe path=~/.config/opencode type=directory and nothing after it. It never logs watcher started or location services booted, and the TUI never draws. Both processes sit idle in futex/epoll waits indefinitely.
When one instance is free, startup works, and the later fs.watch calls fail fast with EMFILE: too many open files, watch '/etc' (logged as failed to watch directory) without blocking. So only the config-directory watcher blocks on exhaustion. That suggests the inotify backend of @parcel/watcher is waiting on a subscription that can never complete.
Steps to reproduce
Exhaust inotify instances for the current user, e.g. temporarily sudo sysctl -w fs.inotify.max_user_instances=<current usage>, or run a process that calls inotify_init() until it gets EMFILE and keeps the descriptors open.
In an empty directory (no .git), run opencode --print-logs --log-level debug.
Observe the blank screen. The last server log line is the watcher subscribe for ~/.config/opencode.
Release one instance and run again: OpenCode starts normally.
Same result with --standalone.
Expected behavior
Start without the file watcher (with a warning), or exit with a clear error that names the inotify limit, rather than hanging silently.
How we hit it
On a headless Linux machine, a long-running process kept spawning dbus-launch. Each leftover dbus-daemon --session held an inotify instance until the default limit of 128 was reached. Any slow leak of inotify instances can trigger this, which makes the silent hang hard to diagnose.
OpenCode version
2.3.0
Operating System
Linux (x86_64, kernel 6.12), headless, max_user_instances=128
Terminal
Any (also reproduced under script(1) with no terminal attached)
Thanks for the clear report and the reproduction steps.
I think this is a duplicate of #62687. That issue was reproduced with the same method you used: max_user_instances lowered and a second process holding every inotify instance. The server then got stuck inside the native @parcel/watcher subscribe call, and it still happened on the latest dev. Your log stops after watcher subscribe and never reaches watcher started, which fits the same stuck call. In your case it happens during TUI startup, on the first watcher.
Possible duplicates and related issues, ordered from most to least likely:
Workaround: start OpenCode with the file watcher turned off, as #62687 confirmed:
OPENCODE_DISABLE_FILEWATCHER=1 opencode
The newer name OPENCODE_FILEWATCHER_DISABLE works too.
I'm closing this issue now as a duplicate of #62687. Please add your details there, especially that it hangs on the first (config directory) watcher with no .git present and still happens on 2.3.0. If you think this is a different problem, reply here and the issue will reopen.
Activity
opencodejr commentedon Nov 16, 2026
Thanks for the clear report and the reproduction steps.
I think this is a duplicate of #62687. That issue was reproduced with the same method you used:
max_user_instanceslowered and a second process holding every inotify instance. The server then got stuck inside the native@parcel/watchersubscribe call, and it still happened on the latestdev. Your log stops afterwatcher subscribeand never reacheswatcher started, which fits the same stuck call. In your case it happens during TUI startup, on the first watcher.Possible duplicates and related issues, ordered from most to least likely:
.git)opencode webpermanently hangs (event loop dead, HTTP timeouts) — main thread deadlocks inside@parcel/watchernative subscribe during multi-project attach (Linux) #37111: the main thread stuck inside the native@parcel/watchersubscribe callEMFILEwhen inotify instances are used upWorkaround: start OpenCode with the file watcher turned off, as #62687 confirmed:
The newer name
OPENCODE_FILEWATCHER_DISABLEworks too.I'm closing this issue now as a duplicate of #62687. Please add your details there, especially that it hangs on the first (config directory) watcher with no
.gitpresent and still happens on 2.3.0. If you think this is a different problem, reply here and the issue will reopen.