opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(tui): show warning when opening WebUI without server mode

Open lxxonx opened this issue 1 day ago • 1 comments

Summary

Fixes #8848

When OpenCode runs without --port flag, the "Open WebUI" command attempts to open http://opencode.internal which is a non-resolvable internal URL used only for RPC communication.

Changes

  • Added a check in the "Open WebUI" command handler to detect when the URL is the internal placeholder
  • Shows a helpful warning toast explaining how to enable server mode instead of silently failing

Before

Clicking "Open WebUI" → Browser opens with http://opencode.internal → ERR_NAME_NOT_RESOLVED

After

Clicking "Open WebUI" → Toast warning: "WebUI requires server mode. Restart with: opencode --port 4096"

Testing

  1. Run opencode (without --port flag)
  2. Press Cmd+P → Select "Open WebUI"
  3. Verify warning toast appears instead of browser opening

Alternative Approaches Considered

  1. Hide the menu item when server not running - Would require passing server state through context, more invasive change
  2. Start server on-demand when WebUI requested - Adds complexity and may have side effects
  3. Show warning (chosen) - Minimal change, clear user feedback, explains the fix

lxxonx avatar Jan 16 '26 09:01 lxxonx