opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Open WebUI fails when running without --port flag (uses unresolvable opencode.internal URL)

Open lxxonx opened this issue 9 hours ago • 1 comments

Bug Description

When running OpenCode without the --port flag (default mode), the "Open WebUI" command (accessible via Cmd+P menu) attempts to open http://opencode.internal in the browser, which fails because this domain doesn't resolve.

Steps to Reproduce

  1. Run opencode without any flags (default mode)
  2. Press Cmd+P to open the command palette
  3. Select "Open WebUI"
  4. Browser opens with http://opencode.internal which fails to load

Expected Behavior

Either:

  • Show a warning that WebUI requires server mode and explain how to enable it
  • Or hide the "Open WebUI" option when server is not running

Root Cause

In packages/opencode/src/cli/cmd/tui/thread.ts, when shouldStartServer is false (default behavior), the URL is set to http://opencode.internal which is only used for internal RPC communication:

```typescript if (shouldStartServer) { const server = await client.call("server", networkOpts) url = server.url // Real localhost URL } else { url = "http://opencode.internal" // Virtual URL for internal RPC customFetch = createWorkerFetch(client) } ```

The "Open WebUI" command in app.tsx then uses this URL directly without checking if it's resolvable:

```typescript { title: "Open WebUI", value: "webui.open", onSelect: () => { open(sdk.url).catch(() => {}) // sdk.url might be "http://opencode.internal" dialog.clear() }, } ```

Workaround

Run OpenCode with the --port flag to start the HTTP server: ```bash opencode --port 4096 ```

Environment

  • OpenCode version: 1.1.23
  • OS: macOS

lxxonx avatar Jan 16 '26 09:01 lxxonx