opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Web UI does not load when running `opencode web`

Open adam-edwards opened this issue 2 weeks ago • 3 comments

Environment

  • OpenCode installed via the curl|bash command and upgraded to the latest (currently 1.0.222)
  • OS: Ubuntu 24.04
  • Terminal: Ghostty
  • Browser: Google Chrome 143.0.7499.169 (Official Build) (64-bit)

Problem

The TUI application works fine. However, when I start the web ui with opencode web --port 8181 --hostname 127.0.0.1 and open my browser to http://127.0.0.1:8181 I get a black screen. The javascript console shows only one error:

Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

If I tell opencode to print debug logs, I get the following output:

❯ opencode web --port 8181 --hostname 127.0.0.1 --print-logs --log-level DEBUG
INFO  2026-01-01T02:22:25 +332ms service=default version=1.0.222 args=["web","--port","8181","--hostname","127.0.0.1","--print-logs","--log-level","DEBUG"] opencode
INFO  2026-01-01T02:22:25 +1ms service=config path=/home/aedwards/.config/opencode/config.json loading
INFO  2026-01-01T02:22:25 +1ms service=config path=/home/aedwards/.config/opencode/opencode.json loading
INFO  2026-01-01T02:22:25 +1ms service=config path=/home/aedwards/.config/opencode/opencode.jsonc loading

                                   ▄
  █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
  █░░█ █░░█ █▀▀▀ █░░█ █░░░ █░░█ █░░█ █▀▀▀
  ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀  ▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀

  Web interface:      http://127.0.0.1:8181/
INFO  2026-01-01T02:22:25 +140ms service=server method=GET path=/ request
INFO  2026-01-01T02:22:25 +0ms service=server status=started method=GET path=/ request
INFO  2026-01-01T02:22:25 +2ms service=default directory=/home/aedwards creating instance
INFO  2026-01-01T02:22:25 +0ms service=project directory=/home/aedwards fromDirectory
INFO  2026-01-01T02:22:25 +6ms service=default directory=/home/aedwards bootstrapping
INFO  2026-01-01T02:22:25 +8ms service=bun cmd=["/home/aedwards/.opencode/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/home/aedwards/.config/opencode running
INFO  2026-01-01T02:22:25 +9ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd)

installed @opencode-ai/[email protected]

[3.00ms] done
 stderr=Saved lockfile
 done
INFO  2026-01-01T02:22:25 +0ms service=bun cmd=["/home/aedwards/.opencode/bin/opencode","install"] cwd=/home/aedwards/.config/opencode running
INFO  2026-01-01T02:22:25 +10ms service=bun code=0 stdout=bun install v1.3.5 (1e86cebd)

Checked 3 installs across 4 packages (no changes) [2.00ms]
 stderr= done
DEBUG 2026-01-01T02:22:25 +13ms service=config loading config from /home/aedwards/.opencode/opencode.jsonc
INFO  2026-01-01T02:22:25 +0ms service=config path=/home/aedwards/.opencode/opencode.jsonc loading
DEBUG 2026-01-01T02:22:25 +0ms service=config loading config from /home/aedwards/.opencode/opencode.json
INFO  2026-01-01T02:22:25 +0ms service=config path=/home/aedwards/.opencode/opencode.json loading
INFO  2026-01-01T02:22:25 +0ms service=bun cmd=["/home/aedwards/.opencode/bin/opencode","add","@opencode-ai/[email protected]","--exact"] cwd=/home/aedwards/.opencode running
INFO  2026-01-01T02:22:25 +8ms service=bun code=0 stdout=bun add v1.3.5 (1e86cebd)

installed @opencode-ai/[email protected]

[2.00ms] done
 stderr=Saved lockfile
 done
INFO  2026-01-01T02:22:25 +0ms service=bun cmd=["/home/aedwards/.opencode/bin/opencode","install"] cwd=/home/aedwards/.opencode running
INFO  2026-01-01T02:22:25 +7ms service=bun code=0 stdout=bun install v1.3.5 (1e86cebd)

Checked 3 installs across 4 packages (no changes) [2.00ms]
 stderr= done
INFO  2026-01-01T02:22:25 +6ms service=plugin path=file:///home/aedwards/.opencode/plugin/notify.ts loading plugin
INFO  2026-01-01T02:22:25 +0ms service=plugin path=file:///home/aedwards/.opencode/plugin/telegram-notify.ts loading plugin
INFO  2026-01-01T02:22:25 +2ms service=plugin [email protected] loading plugin
INFO  2026-01-01T02:22:25 +6ms service=plugin [email protected] loading plugin
INFO  2026-01-01T02:22:25 +18ms service=bus type=* subscribing
INFO  2026-01-01T02:22:25 +0ms service=bus type=session.updated subscribing
INFO  2026-01-01T02:22:25 +0ms service=bus type=message.updated subscribing
INFO  2026-01-01T02:22:25 +0ms service=bus type=message.part.updated subscribing
INFO  2026-01-01T02:22:25 +0ms service=bus type=session.updated subscribing
INFO  2026-01-01T02:22:25 +0ms service=bus type=message.updated subscribing
INFO  2026-01-01T02:22:25 +0ms service=bus type=message.part.updated subscribing
INFO  2026-01-01T02:22:25 +0ms service=bus type=session.diff subscribing
INFO  2026-01-01T02:22:25 +0ms service=format init
INFO  2026-01-01T02:22:25 +0ms service=bus type=file.edited subscribing
INFO  2026-01-01T02:22:25 +1ms service=lsp serverIds=deno, typescript, vue, eslint, oxlint, biome, gopls, ruby-lsp, pyright, elixir-ls, zls, csharp, fsharp, sourcekit-lsp, rust, clangd, svelte, astro, jdtls, yaml-ls, lua-ls, php intelephense, prisma, dart, ocaml-lsp, bash, terraform, texlab, dockerfile, gleam, clojure-lsp, nixd, tinymist, haskell-language-server enabled LSP servers
INFO  2026-01-01T02:22:25 +2ms service=bus type=command.executed subscribing
INFO  2026-01-01T02:22:26 +283ms service=server status=completed duration=381 method=GET path=/ request
INFO  2026-01-01T02:22:26 +11ms service=server method=GET path=/assets/index-BpUh5VHS.js request
INFO  2026-01-01T02:22:26 +0ms service=server status=started method=GET path=/assets/index-BpUh5VHS.js request
INFO  2026-01-01T02:22:26 +1ms service=server method=GET path=/assets/index-DGT9sXGT.css request
INFO  2026-01-01T02:22:26 +0ms service=server status=started method=GET path=/assets/index-DGT9sXGT.css request
INFO  2026-01-01T02:22:26 +330ms service=server status=completed duration=330 method=GET path=/assets/index-DGT9sXGT.css request
INFO  2026-01-01T02:22:26 +4ms service=server status=completed duration=335 method=GET path=/assets/index-BpUh5VHS.js request
INFO  2026-01-01T02:22:28 +2354ms service=server method=GET path=/site.webmanifest request
INFO  2026-01-01T02:22:28 +0ms service=server status=started method=GET path=/site.webmanifest request
INFO  2026-01-01T02:22:29 +143ms service=server status=completed duration=143 method=GET path=/site.webmanifest request

Just a couple of other observations FWIW:

  • I've tried it in Incognito mode with the same result
  • I've tried it in Firefox with the same result
  • If I run OpenCode in Docker, same result: docker run -d --rm -p 8181:8181 -v ~/workspace/myapp:/workspace -w /workspace ghcr.io/sst/opencode web --port 8181 --hostname 0.0.0.0
  • I've tried downgrading opencode through several versions (all the way down to 1.0.200), same result
  • I just used this successfully on a Macbook a few days ago (with the Docker method)

Please let me know if I can provide any other details.

adam-edwards avatar Jan 01 '26 02:01 adam-edwards

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

  • #6122: Web UI fails to load - JS module blocked due to incorrect MIME type
  • #5237: opencode web mode broken: empty page - multiple versions and multiple os

Both issues show the exact same error: 'Failed to load module script: Expected a JavaScript-or-Wasm module script but the server responded with a MIME type of...' and report blank screens when running opencode web. These may address your specific case.

github-actions[bot] avatar Jan 01 '26 02:01 github-actions[bot]

I believe https://github.com/sst/opencode/pull/6587 resolves this.

ericclemmons avatar Jan 01 '26 19:01 ericclemmons

This fix should go out today

adamdotdevin avatar Jan 02 '26 12:01 adamdotdevin