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

Closed
opened 2026-02-16 18:04:16 -05:00 by yindo · 1 comment
Owner

Originally created by @lxxonx on GitHub (Jan 16, 2026).

Originally assigned to: @rekram1-node on GitHub.

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
Originally created by @lxxonx on GitHub (Jan 16, 2026). Originally assigned to: @rekram1-node on GitHub. ## 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
yindo added the web label 2026-02-16 18:04:16 -05:00
yindo closed this issue 2026-02-16 18:04:16 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 16, 2026):

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

  • #8407: webUI open with opencode.internal instead of 127.0.0.1 from cmd pallete
  • #7549: Open WebUI command not working on WSL

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 16, 2026): This issue might be a duplicate of existing issues. Please check: - #8407: webUI open with opencode.internal instead of 127.0.0.1 from cmd pallete - #7549: Open WebUI command not working on WSL Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6455