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
desktop: internal browser panel disappears — browser scope fails with SyntaxError: Identifier 'n' has already been declared #60369
The desktop app's internal browser backend dies with SyntaxError: Identifier 'n' has already been declared, and the "Browser/Navegador" entry vanishes from the session + panel menu. Restarting the app restores it temporarily, then it disappears again.
Open OpenCode Desktop 2.2.2 on Windows, one window, local v2 server (2.2.2 on http://127.0.0.1:28894).
Open a session and use the internal browser (menu + → Browser, or Ctrl+Alt+B). It works at first — pages load.
After some time, open the + panel menu again: the Browser entry (globe icon) is gone; only Review, Terminal, Open file remain.
App restart brings the entry back, then it disappears again.
Expected Behavior
The Browser panel entry should stay available while connected to a compatible local v2 server.
Actual Behavior
The entry is hidden. main.log shows the browser scope failing:
[error] (main) scope finalizer failed {
scope: 'browser',
error: "SyntaxError: Identifier 'n' has already been declared\n" +
' at compileSourceTextModule (node:internal/modules/esm/utils:320:16)\n' +
...
}
### Plugins
open code
### OpenCode version
2.2.2
### Steps to reproduce
_No response_
### Screenshot
_No response_
### Operating System
WINDOWS 11
### Terminal
WINDOWS TERMINAL
Thanks for the detailed report and the main.log excerpt. I can confirm the error.
I built the desktop main process from the v2.2.2 tag (bunx electron-vite build) and checked each output chunk with node --check. The only chunk that fails is the internal browser's pane chunk, with exactly your error: SyntaxError: Identifier 'n' has already been declared.
The cause seems to be two top-level require declarations in that chunk. One comes from the CommonJS shim banner the desktop build adds to every main chunk. The other comes from a bundled @effect/platform-node module. The minifier renames both to n. The browser plugin loads that chunk lazily and also waits for it when shutting down. That matches the scope finalizer failed { scope: 'browser' } entry in your log.
A build of the latest dev (b19d143) fails the same way. The script below reproduces it, and I've left details for the maintainers. One thing I couldn't explain: you see the browser working at first, so the menu entry disappearing may also involve the states described in #60023 (Browser launcher disappears until restart).
Reproduction script (check-pane-chunk.sh)
#!/usr/bin/env bash# Reproduces #60369: the desktop main-process browser "pane" chunk fails to compile as ESM.# Usage: check-pane-chunk.sh [git-ref] (default: v2.2.2). Needs git, bun, node >= 20.set -euo pipefail
REF="${1:-v2.2.2}"
WT="${TMPDIR:-/tmp}/oc-pane-$REF"
git clone -q --depth 1 --branch "$REF" https://github.com/anomalyco/opencode.git "$WT"2>/dev/null \
|| { git clone -q https://github.com/anomalyco/opencode.git "$WT"&& git -C "$WT" checkout -q "$REF"; }
cd"$WT"&& bun install >/dev/null
cd packages/desktop && bunx electron-vite build >/dev/null
cd out/main
status=0
forfin*.js;do
cp "$f" /tmp/chk.mjs # .mjs so node parses it as an ES module, as Electron doesif! node --check /tmp/chk.mjs 2>/tmp/chk.err >/dev/null;thenecho"FAIL $f: $(grep -m1 -o 'SyntaxError.*' /tmp/chk.err)"
status=1
fidone# Show the colliding declarations: the CommonJS banner's `require` and# @effect/platform-node's internal/http.js top-level `const require = createRequire(...)`.
grep -o '^.\{0,120\}' pane-*.js | head -1
exit$status
Bundled CLI 2.2.2 is the active server: ~/Library/Application Support/ai.opencode.desktop/cli/2.2.2-arm64/opencode-cli serve --service on 127.0.0.1:49374 (verified with lsof; no separate opencode from PATH involved)
OS: macOS 26.6.2 (build 25G83), arm64
Node 24.22.1, used only for the offline check below
Plugins: none ("plugins": [] in ~/.config/opencode/opencode.json), no browser permission rules anywhere
Symptoms
Open a session, click + in the side panel: only Review / Terminal / Open file are listed. Browser is never offered, not even briefly.
Ctrl+Cmd+B ("Open browser") does nothing; the command is disabled.
browser.* is absent from the Code Mode tool catalog.
Quitting and relaunching the app, and separately restarting the sidecar so the app spawns its own bundled CLI, both leave it broken. It is deterministic, not a transient state.
Decisive test
Extracted every chunk under /out/main/ from /Applications/OpenCode.app/Contents/Resources/app.asar and compiled each one as an ES module, the way Electron loads them:
# 650 chunks from /out/main, each copied to .mjs and checked
$ node --check pane-Bs9c3oLB.js
SyntaxError: Identifier 'n' has already been declared
at checkSyntax (node:internal/main/check_syntax:84:5)
650 chunks checked, 1 failed: out/main/pane-Bs9c3oLB.js (84,183 bytes)
The failing chunk is the browser pane — same file class as pane-CwHDCUMq.js in the Windows reports, different hash. The other 649 chunks compile fine, so this matches the maintainer's analysis (shim banner require + bundled @effect/platform-noderequire, both minified to n) and shows it reproduces on a separately built macOS artifact, not just the tagged build.
Log
~/Library/Application Support/ai.opencode.desktop/logs/20261030T054345/main.log, right after the pane is first requested:
[2026-10-30 13:44:11.464] [error] (main) scope finalizer failed {
scope: 'browser',
error: "SyntaxError: Identifier 'n' has already been declared\n" +
' at compileSourceTextModule (node:internal/modules/esm/utils:320:16)\n' +
' at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:89:18)\n' +
...
The entry is only written when the pane is actually loaded (opening the side panel), which is why a log grep at startup finds nothing.
Why the UI gives no hint
The launcher item is gated on available(session) && attached(session); attached requires the registration that this chunk load was supposed to provide. The failure is swallowed by the registration .catch(), so the menu item and the command disappear silently — consistent with #60444.
The desktop main-process bundle declared require twice, which broke the in-app browser and its browser.* tools.
Please update to 2.2.3. In the desktop app, use Check for Updates, or install it from the release page. If the browser pane still doesn't appear afterwards, please reopen this issue with your main.log from the logs folder.
Activity
opencodejr commentedon Oct 29, 2026
Thanks for the detailed report and the
main.logexcerpt. I can confirm the error.I built the desktop main process from the
v2.2.2tag (bunx electron-vite build) and checked each output chunk withnode --check. The only chunk that fails is the internal browser's pane chunk, with exactly your error:SyntaxError: Identifier 'n' has already been declared.The cause seems to be two top-level
requiredeclarations in that chunk. One comes from the CommonJS shim banner the desktop build adds to every main chunk. The other comes from a bundled@effect/platform-nodemodule. The minifier renames both ton. The browser plugin loads that chunk lazily and also waits for it when shutting down. That matches thescope finalizer failed { scope: 'browser' }entry in your log.A build of the latest
dev(b19d143) fails the same way. The script below reproduces it, and I've left details for the maintainers. One thing I couldn't explain: you see the browser working at first, so the menu entry disappearing may also involve the states described in #60023 (Browser launcher disappears until restart).Reproduction script (check-pane-chunk.sh)
Run it:
bash check-pane-chunk.shmiaolong001 commentedon Oct 30, 2026
Same failure on macOS, confirming it is build-to-build and not specific to the Windows artifact. Different chunk hash, identical defect.
Environment
opencode-desktop2.2.2, packaged, auto-update reports 2.2.2 as latest)~/Library/Application Support/ai.opencode.desktop/cli/2.2.2-arm64/opencode-cli serve --serviceon127.0.0.1:49374(verified withlsof; no separateopencodefromPATHinvolved)"plugins": []in~/.config/opencode/opencode.json), no browser permission rules anywhereSymptoms
Ctrl+Cmd+B("Open browser") does nothing; the command is disabled.browser.*is absent from the Code Mode tool catalog.Quitting and relaunching the app, and separately restarting the sidecar so the app spawns its own bundled CLI, both leave it broken. It is deterministic, not a transient state.
Decisive test
Extracted every chunk under
/out/main/from/Applications/OpenCode.app/Contents/Resources/app.asarand compiled each one as an ES module, the way Electron loads them:The failing chunk is the browser pane — same file class as
pane-CwHDCUMq.jsin the Windows reports, different hash. The other 649 chunks compile fine, so this matches the maintainer's analysis (shim bannerrequire+ bundled@effect/platform-noderequire, both minified ton) and shows it reproduces on a separately built macOS artifact, not just the tagged build.Log
~/Library/Application Support/ai.opencode.desktop/logs/20261030T054345/main.log, right after the pane is first requested:The entry is only written when the pane is actually loaded (opening the side panel), which is why a log grep at startup finds nothing.
Why the UI gives no hint
The launcher item is gated on
available(session) && attached(session);attachedrequires the registration that this chunk load was supposed to provide. The failure is swallowed by the registration.catch(), so the menu item and the command disappear silently — consistent with #60444.Hona commentedon Oct 30, 2026
Fixed in 2.2.3 by #60430.
The desktop main-process bundle declared
requiretwice, which broke the in-app browser and itsbrowser.*tools.Please update to 2.2.3. In the desktop app, use Check for Updates, or install it from the release page. If the browser pane still doesn't appear afterwards, please reopen this issue with your
main.logfrom the logs folder.