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
fix: false MaxListenersExceededWarning on GlobalBus during normal event fanout #23798
When multiple consumers subscribe to the shared GlobalBusevent channel at the same time, OpenCode can emit Node's MaxListenersExceededWarning even though the subscriptions are part of normal runtime behavior.
Plugins
Observed in a local setup with multiple plugins enabled, but the warning points at the shared GlobalBus fanout path rather than one plugin-specific emitter.
OpenCode version
1.14.19
Steps to reproduce
Run OpenCode with the app/TUI and normal background consumers active
Open overlapping /global/event listeners during reconnects or concurrent consumers
Observe MaxListenersExceededWarning for the shared EventEmitter
Screenshot and/or share link
N/A
Operating System
Ubuntu 22.04
Terminal
zsh on Linux
Reacted by Jason George, jadedejiamp, Mohamed Ayoub Jabane, hueyexe and Daniel Gribkov
I can reproduce this on 1.14.48 from opencode web, without any plugin involvement.
This looks less like spooky memory-leak magic and more like the global SSE endpoint doing exactly what Node warns about: every /global/event stream attaches another GlobalBus.on("event", handler), then the 11th concurrent listener trips MaxListenersExceededWarning.
MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 event listeners added to [hz]. MaxListeners is undefined. Use events.setMaxListeners() to increase limit
emitter: hz {
_events: [Object ...],
_eventsCount: 1,
_maxListeners: undefined,
[Symbol(kCapture)]: false,
emit: [Function: emit],
setMaxListeners: [Function: setMaxListeners],
getMaxListeners: [Function: getMaxListeners],
addListener: [Function: addListener],
on: [Function: addListener],
prependListener: [Function: prependListener],
once: [Function: once],
prependOnceListener: [Function: prependOnceListener],
removeListener: [Function: removeListener],
off: [Function: removeListener],
removeAllListeners: [Function: removeAllListeners],
listeners: [Function: listeners],
rawListeners: [Function: rawListeners],
listenerCount: [Function: listenerCount],
eventNames: [Function: eventNames],
},
type: "event",
count: 11,
at overflowWarning (node:events:185:19)
at addListener (node:events:158:22)
at ~effect/Effect/evaluate (/$bunfs/root/chunk-w8ygwpb0.js:25:4492)
at runLoop (/$bunfs/root/chunk-w8ygwpb0.js:25:2045)
at evaluate (/$bunfs/root/chunk-w8ygwpb0.js:25:1435)
at runTasks (/$bunfs/root/chunk-w8ygwpb0.js:11:33426)
at afterScheduled (/$bunfs/root/chunk-w8ygwpb0.js:11:33313)
Environment:
OpenCode: 1.14.48
OS: Ubuntu Linux 6.8.0-111-generic x86_64
Command: opencode web --hostname 0.0.0.0 --port 4096
Expected: serving multiple legitimate web/SSE clients should not print a memory leak warning during normal operation. If this fanout is expected, GlobalBus probably needs an explicit max listener policy or a different fanout shape so users do not get scared by a false positive warning.
Same here. opencode ver v1.15.2. Windows 11 latest update. Print in the terminal: opencode web
! OPENCODE_SERVER_PASSWORD is not set; server is unsecured.
at overflowWarning (node:events:185:19)
at addListener (node:events:158:22)
at ~effect/Effect/evaluate (B:/~BUN/root/chunk-kh42tdx7.js:25:4492)
at runLoop (B:/~BUN/root/chunk-kh42tdx7.js:25:2045)
at evaluate (B:/~BUN/root/chunk-kh42tdx7.js:25:1435)
at runTasks (B:/~BUN/root/chunk-kh42tdx7.js:11:33531)
at afterScheduled (B:/~BUN/root/chunk-kh42tdx7.js:11:33418)
Activity
Rhiz3K commentedon May 14, 2026
I can reproduce this on 1.14.48 from
opencode web, without any plugin involvement.This looks less like spooky memory-leak magic and more like the global SSE endpoint doing exactly what Node warns about: every
/global/eventstream attaches anotherGlobalBus.on("event", handler), then the 11th concurrent listener tripsMaxListenersExceededWarning.Repro:
Then open 11 concurrent SSE clients:
Actual output:
Environment:
Expected: serving multiple legitimate web/SSE clients should not print a memory leak warning during normal operation. If this fanout is expected,
GlobalBusprobably needs an explicit max listener policy or a different fanout shape so users do not get scared by a false positive warning.SurealCereal commentedon May 16, 2026
Exactly what I saw now with
1.15.3jasgeo75 commentedon May 19, 2026
Seeing the same with
1.15.5TheAPIguys commentedon May 21, 2026
Same here. opencode ver v1.15.2. Windows 11 latest update. Print in the terminal: opencode web
! OPENCODE_SERVER_PASSWORD is not set; server is unsecured.
█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
Web interface: http://127.0.0.1:41423/
MaxListenersExceededWarning: Possible EventTarget memory leak detected. 11 event listeners added to [dI]. MaxListeners is undefined. Use events.setMaxListeners() to increase limit
emitter: dI {
_events: [Object ...],
_eventsCount: 1,
_maxListeners: undefined,
[Symbol(kCapture)]: false,
emit: [Function: emit],
setMaxListeners: [Function: setMaxListeners],
getMaxListeners: [Function: getMaxListeners],
addListener: [Function: addListener],
on: [Function: addListener],
prependListener: [Function: prependListener],
once: [Function: once],
prependOnceListener: [Function: prependOnceListener],
removeListener: [Function: removeListener],
off: [Function: removeListener],
removeAllListeners: [Function: removeAllListeners],
listeners: [Function: listeners],
rawListeners: [Function: rawListeners],
listenerCount: [Function: listenerCount],
eventNames: [Function: eventNames],
},
type: "event",
count: 11,
github-actions commentedon Jul 20, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.