You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Web UI fails to load - JS module blocked due to incorrect MIME type #6122
When I try to the WebUI, it gets stuck with this error in a blank page/
OpenCode version
OpenCode 1.0.198
Steps to reproduce
It occurs in both, with opencode serve and after the opening from the terminal, using Open WebUI.
Open opencode
Click Ctrl + P and select Open WebUI
It shows as a blank screen
Screenshot and/or share link
The screenshot shows Zen (Firefox), but it was tested in Chrome, Helium, brave
Loading module from “http://127.0.0.1:4096/assets/index-CFCjwJ3H.js” was blocked because of a disallowed MIME type (“text/html”). 127.0.0.1:4096
Loading failed for the module with source “http://127.0.0.1:4096/assets/index-CFCjwJ3H.js”. 127.0.0.1:4096:16:71
Operating System
Linux archlinux 6.18.2-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 18 Dec 2025 18:00:18 +0000 x86_64 GNU/Linux
Still broken on 1.0.203 (CORS errors), launched with "opencode web --hostname 0.0.0.0 --port 4096":
Note that this issue occurs when I attempt to access the web UI from a different machine. The CORS errors are gone if I access from the same machine (regardless of whether I use "localhost", "127.0.0.1" or the actual LAN IP).
Just FYI, if anyone else is running into this, the workaround is to load the web UI using:
http://lan_ip:port/?url=http://lan_ip:port
For a permanent fix, here's a patch that can be applied to packages/app/src/app.tsx and makes it respect whatever was passed to "--hostname"
--- a/packages/app/src/app.tsx
+++ b/packages/app/src/app.tsx
@@ -34,6 +34,12 @@ const url = iife(() => {
if (location.hostname.includes("opencode.ai")) return "http://localhost:4096"
if (window.__OPENCODE__) return `http://127.0.0.1:${window.__OPENCODE__.port}`
+
+ // If accessing from a non-localhost hostname (e.g., LAN IP via --hostname),
+ // use the current origin since the API is served from the same server
+ if (!["localhost", "127.0.0.1"].includes(location.hostname)) {
+ return window.location.origin
+ }
+
if (import.meta.env.DEV)
return `http://${import.meta.env.VITE_OPENCODE_SERVER_HOST ?? "localhost"}:${import.meta.env.VITE_OPENCODE_SERVER_PORT ?? "4096"}`
Activity
github-actions commentedon Dec 24, 2025
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
nathabonfim59 commentedon Dec 24, 2025
It seems to work in when running with
bun devfrom sourcenathabonfim59 commentedon Dec 25, 2025
It appears to be fixed in
1.0.200. Thanks!mrsaraiva commentedon Dec 26, 2025
Still broken on 1.0.203 (CORS errors), launched with "opencode web --hostname 0.0.0.0 --port 4096":
Note that this issue occurs when I attempt to access the web UI from a different machine. The CORS errors are gone if I access from the same machine (regardless of whether I use "localhost", "127.0.0.1" or the actual LAN IP).
mrsaraiva commentedon Dec 26, 2025
Just FYI, if anyone else is running into this, the workaround is to load the web UI using:
http://lan_ip:port/?url=http://lan_ip:port
For a permanent fix, here's a patch that can be applied to packages/app/src/app.tsx and makes it respect whatever was passed to "--hostname"