Skip to content

web: 'opencode web' crashes on headless Linux (ENOENT: xdg-open not found) #49446

Closed as not planned

Description

@usald2533-boop

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 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.

Env

  • opencode 1.18.31 (also affects latest)
  • Ubuntu 24.04 devcontainer, headless

Activity

  1. github-actions commented on Sep 17, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. lmfont commented on Sep 27, 2026

    @lmfont

    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.

  3. frap129 commented on Oct 2, 2026

    @frap129

    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)

    #!/usr/bin/env bash
    exit 0
    
  4. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions