Skip to content

opencode auth login crashes on Linux without xdg-open #52548

Closed

Description

@ZharaskhanAman

Description

On a Linux box without xdg-utils (SSH, containers), opencode auth login prints the authorization URL and then exits with Error: Executable not found in $PATH: "xdg-open" and a stack trace, so the login can't be finished.

openUrl in packages/cli/src/ui/prompt.ts wraps the launch in Effect.promise(...).pipe(Effect.ignore). Effect.promise turns the rejection into a defect, and Effect.ignore doesn't catch defects. The compiled binary has no bundled xdg-open, so open falls back to the system one. Someone posted the same trace in #49446 (that issue is about opencode web on v1).

◇  Authorization started
●  Enter code: XXXX-XXXX
●  https://opencode.ai/console/device?user_code=XXXX-XXXX&client_id=opencode-cli
Error: Executable not found in $PATH: "xdg-open"
    at spawn (unknown)
    at spawn (node:child_process:721:35)
    at cli.prompt.open-url (/$bunfs/root/chunk-v0je57yf.js:6:7614)
    at cli.auth.login.oauth (/$bunfs/root/chunk-v0je57yf.js:6:6699)
    at cli.auth.login.authenticate (/$bunfs/root/chunk-v0je57yf.js:6:5199)
    at cli.auth.login.run (/$bunfs/root/chunk-v0je57yf.js:6:4663)

Plugins

No response

OpenCode version

2.0.21 (the same code is on v2 at 4f37be6)

Steps to reproduce

  1. On Linux, make sure xdg-open is not on PATH.
  2. Run opencode auth login opencode in a terminal.
  3. Choose "OpenCode Console account".

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04

Terminal

SSH session

Activity

  1. rkoten commented on Oct 11, 2026

    @rkoten

    Reproducing the same issue on 2.0.26 on a VPS via SSH.

    A combination of these two solutions worked for me to authenticate with my OpenAI account via browser:

  2. guneet-xyz commented on Oct 12, 2026

    @guneet-xyz

    While #52678 gets merged, temporary workaround is to create a dummy 'xdg-open'.

    cat > /usr/local/bin/xdg-open << EOF
    #!/usr/bin/env bash
    exit 0
    EOF
    
    chmod +x /usr/local/bin/xdg-open
  3. heymaaz commented on Oct 14, 2026

    @heymaaz

    Really need this to be fixed for my plugin.

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