anomalyco / anomalyco/opencode
web: 'opencode web' crashes on headless Linux (ENOENT: xdg-open not found)
@Hona is already working on this.
Since Sep 17, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Bug
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 noxdg-openbinary), it should skip auto-open gracefully (log a warning) instead of crashing. - Bonus: a
--no-open/--dont-openflag would help scripts/containers.
Workaround (current)
Install xdg-utils in the container (apt-get install -y xdg-utils) so xdg-open exists.
Env
- opencode 1.18.31 (also affects latest)
- Ubuntu 24.04 devcontainer, headless
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.