Skip to content

Web UI fails to load - JS module blocked due to incorrect MIME type #6122

Closed

Description

@nathabonfim59

Description

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.

  1. Open opencode
  2. Click Ctrl + P and select Open WebUI
  3. It shows as a blank screen

Screenshot and/or share link

The screenshot shows Zen (Firefox), but it was tested in Chrome, Helium, brave

Image
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
Image

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

Terminal

Ghostty (but it's web, not terminal)

Activity

  1. github-actions commented on Dec 24, 2025

    @github-actions
    Contributor

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

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

  2. nathabonfim59 commented on Dec 24, 2025

    @nathabonfim59
    Author

    It seems to work in when running with bun dev from source

  3. nathabonfim59 commented on Dec 25, 2025

    @nathabonfim59
    Author

    It appears to be fixed in 1.0.200. Thanks!

  4. mrsaraiva commented on Dec 26, 2025

    @mrsaraiva

    Still broken on 1.0.203 (CORS errors), launched with "opencode web --hostname 0.0.0.0 --port 4096":

    Image

    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).

  5. mrsaraiva commented on Dec 26, 2025

    @mrsaraiva

    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"}`
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwebRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions