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
web: 'opencode web' crashes on headless Linux (ENOENT: xdg-open not found) #49446
Running opencode web on a headless Linux environment (e.g. a GitHub Codespace / container without a desktop) starts the server, prints the banner, then crashes because it tries to auto-open a browser via xdg-open, which does not exist in the container.
Repro
In a mcr.microsoft.com/devcontainers/base:ubuntu codespace (no xdg-utils installed):
$ opencode web --port 3000 --hostname 0.0.0.0
! OPENCODE_SERVER_PASSWORD is not set; server is unsecured.
█▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
█ █ █ █ █▀▀▀ █ █ █ █ █ █ █ █▀▀▀
▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
Local access: http://localhost:3000
Network access: http://10.0.0.99:3000
error: Executable not found in $PATH: "xdg-open"
path: "xdg-open",
errno: -2,
syscall: "spawn xdg-open",
spawnargs: [ "http://localhost:3000" ],
code: "ENOENT"
The whole process exits (exit code 1), taking the web server down with it. The server itself started fine (port responds 200 before the crash).
Expected
The server should keep running; opening a browser is a convenience, not a requirement.
In headless environments (no DISPLAY/WAYLAND_DISPLAY, or no xdg-open binary), it should skip auto-open gracefully (log a warning) instead of crashing.
Bonus: a --no-open/--dont-open flag would help scripts/containers.
Workaround (current)
Install xdg-utils in the container (apt-get install -y xdg-utils) so xdg-open exists.
I see this as well, here's a traceback. I'm using release version 2.0.18-1.
Error: Executable not found in $PATH: "xdg-open"
at spawn (unknown)
at spawn (node:child_process:721:35)
at spawn (node:child_process:22:39)
at <anonymous> (/$bunfs/root/chunk-j6xbbrsg.js:4:4754)
at processTicksAndRejections (native:7:39)
at cli.prompt.open-url (/$bunfs/root/chunk-m043hngd.js:2:8662)
at cli.prompt.open-url (definition) (/$bunfs/root/chunk-kdtyxy9m.js:2:374)
at cli.auth.login.oauth (/$bunfs/root/chunk-m043hngd.js:2:7758)
at cli.auth.login.oauth (definition) (/$bunfs/root/chunk-m043hngd.js:2:8118)
at cli.auth.login.authenticate (/$bunfs/root/chunk-m043hngd.js:2:6286)
at cli.auth.login.authenticate (definition) (/$bunfs/root/chunk-m043hngd.js:2:7607)
at cli.auth.login.run (/$bunfs/root/chunk-m043hngd.js:2:5751)
at cli.auth.login.run (definition) (/$bunfs/root/chunk-m043hngd.js:2:5869)
at cli.auth.login (/$bunfs/root/chunk-dkzkwb7t.js:49:18467)
at cli.auth.login (definition) (/$bunfs/root/chunk-m043hngd.js:2:5726)
The related bug #31815 was allowed to close because the issue was supposedly fixed, but it's not working for me.
Activity
github-actions commentedon Sep 17, 2026
This issue might be a duplicate of existing issues. Please check:
opencode webshowsENOENT: xdg-openerror in container environments #31815:opencode webshowsENOENT: xdg-openerror in container environments — same root cause, same error, same request for graceful handling in headless/container environmentslmfont commentedon Sep 27, 2026
I see this as well, here's a traceback. I'm using release version 2.0.18-1.
The related bug #31815 was allowed to close because the issue was supposedly fixed, but it's not working for me.
frap129 commentedon Oct 2, 2026
As a simpler workaround, you can make a script named xdg-open that only exits successfully and put it in your path somewhere (
/usr/local/bin)thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊