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
Regression in 1.18.30: every prompt crashes with TypeError in SystemPrompt.environment ("a.name") — 1.18.18 works fine #48645
After updating to opencode 1.18.30 via pacman, every single prompt fails immediately with:
Failed to send prompt. Unexpected server error. Check server logs for details.
This happens on a brand new session, on the very first message, with no tool calls or special input needed. It reproduces identically regardless of model/provider — I saw it with opencode/big-pickle and later with google/gemini-3.8-flash and google/gemini-3.1-pro-preview in the same log, so it isn't provider-specific.
The actual log shows a client-side crash before any request reaches a model:
TypeError: undefined is not an object (evaluating 'a.name')
at resolve (/$bunfs/root/chunk-13bwg24f.js:2:1659)
at a (/$bunfs/root/chunk-13bwg24f.js:2:936)
at map (native:1:11)
at (/$bunfs/root/chunk-13bwg24f.js:2:1626)
at a (/$bunfs/root/chunk-13bwg24f.js:2:1166)
at map (native:1:11)
at (/$bunfs/root/chunk-13bwg24f.js:2:1626)
at a (/$bunfs/root/chunk-13bwg24f.js:2:1166)
at map (native:1:11)
at (/$bunfs/root/chunk-13bwg24f.js:2:1390)
at SystemPrompt.environment (/$bunfs/root/chunk-5gp4k9hv.js:50:13096)
at SessionPrompt.run (/$bunfs/root/chunk-5gp4k9hv.js:50:14576)
at SessionRunState.ensureRunning (/$bunfs/root/chunk-5gp4k9hv.js:50:14545)
at SessionPrompt.loop (/$bunfs/root/chunk-5gp4k9hv.js:50:9849)
at SessionPrompt.prompt (/$bunfs/root/chunk-ct5m76jw.js:6:11695)
I ruled out my own config as the cause: my opencode.jsonc only contains { "$schema": "https://opencode.ai/config.json" }, and I also fully moved ~/.config/opencode aside (mv ~/.config/opencode ~/.config/opencode.bak) and relaunched — the crash still happened identically with a completely fresh/empty config.
Downgrading to 1.18.18 (via the cached pacman package) fixes it immediately — same machine, same everything else. This points to a regression introduced between 1.18.18 and 1.18.30.
Plugins
None
OpenCode version
1.18.30 (regression); confirmed working on 1.18.18 and 1.18.7
Steps to reproduce
Install/update to opencode 1.18.30 on Arch Linux (official pacman package, not AUR)
Run opencode in any directory
Send any prompt, e.g. "hello"
Observe: "Failed to send prompt. Unexpected server error. Check server logs for details."
Check ~/.local/share/opencode/log/ — see the TypeError above in SystemPrompt.environment
Downgrade to 1.18.18 (sudo pacman -U /var/cache/pacman/pkg/opencode-1.18.18-1-x86_64.pkg.tar.zst) — works fine
Screenshot and/or share link
No response
Operating System
Arch Linux (installed via official opencode pacman package)
Terminal
Standard TUI (opencode run in terminal)
Reacted by criticalbugbounty, Danny Thuering, Jonathan Mayer, Felix Tröbinger, Lukas Gierth, Dan Hughes, Mark, Arnór Gjúki Jónsson, Tomas Zaluckij, Mark Eschbach and 8 more
This issue might be a duplicate of existing issues. Please check:
SystemPrompt.environment #48372: Same crash — TypeError: undefined is not an object (evaluating 'a.name') in SystemPrompt.environment on v1.18.30, reproduces on every prompt with a clean config/home, identical stack trace.
I analysed the issue with Claude, here's the summary and workaround.
opencode v1.18.30: SystemPrompt.environment crashes with TypeError: undefined is not an object (evaluating 'a.name')
Description
opencode v1.18.30 crashes when building the system prompt environment. The error occurs in the embedded v2 model catalog resolution code during nested .map() iterations, where an array element is undefined but the code expects an object with a .name property.
This makes opencode completely unusable — any prompt submission fails with:
▎ Failed to send prompt
▎ Unexpected server error. Check server logs for details.
The error is not caused by user configuration, plugins, cache, or project state. It reproduces from any directory, even with --pure (no external plugins).
TypeError: undefined is not an object (evaluating 'a.name')
at resolve (/$bunfs/root/chunk-36bwgd4p.js:2:1659)
at a (/$bunfs/root/chunk-36bwgd4p.js:2:936)
at map (native:1:11)
...
at SystemPrompt.environment (/$bunfs/root/chunk-y88jw4qv.js:50:13096)
Reproduction
# Confirm version
opencode --version
# Expected: 1.18.30
# Reproduce the crash (no project or config needed)
cd /tmp && mkdir -p opencode-bug && cd opencode-bug && git init -q
opencode debug v2 --pure
# Output: Error: Unexpected error — undefined is not an object (evaluating 'a.name')
Proof that v1.18.29 is not affected
# Install v1.18.29 via curl
opencode upgrade 1.18.29 -m curl
# Run directly (bypass any brew-installed 1.18.30)
~/.opencode/bin/opencode --version
# Output: 1.18.29
~/.opencode/bin/opencode debug v2 --pure
# Output: { "providers": [ ... ] } ← works fine
Workaround
If opencode was installed via brew, unlink the broken v1.18.30 and fall back to v1.18.29 installed via curl:
opencode upgrade 1.18.29 -m curl
brew unlink opencode
opencode --version # should now show 1.18.29
Environment
opencode v1.18.30 (Homebrew, macOS arm64)
macOS Darwin 25.6.0
Regression introduced between v1.18.29 and v1.18.30
Reacted by Alper Kanat, Dante Alferez Condori, Lukas Gierth and Jeremy Grecu
Also affected on macOS. I ran an A/B plus a build-to-build comparison that narrows this down further, so posting the data here since this is the "regression" issue.
1. The regression window is exactly one release: 1.18.29 → 1.18.30
Same machine, same ~/.config/opencode, same directory, back to back:
Ruled out: plugins (--pure), MCP servers, LSPs, git vs non-git, and the references block from #48809 (mine is commented out). opencode agent list --pure does not crash for me — only the prompt path does, i.e. SystemPrompt.environment.
3. The bun-compiled binary is affected; the Electron build of the same 1.18.30 is not
This looks like the most useful datapoint. I have both installed:
/opt/homebrew/bin/opencode → 1.18.30, bun single-file binary → crashes on every prompt
/Applications/OpenCode.app → 1.18.30 (Electron/Node bundle) → never crashed once
Over the exact window in which 81 level=ERRORa.name crashes were logged from five separate CLI/TUI processes, the desktop app's server in the same shared log kept logging booting location services successfully for many directories, and produced zero crashes.
The Electron app.asar contains booting location services and SystemPrompt.environment but zero occurrences of $bunfs or chunk-36bwgd4p — same source, different bundle. Every stack trace in this issue and in #48803 / #48811 / #48809 / #48372 is /$bunfs/root/chunk-*.js.
That points at a bundling / module-initialisation artifact of the bun compile step rather than a source-level logic bug — consistent with the failure mode below. (Stated as a hypothesis; I have not bisected the source.)
4. Where it dies
From the bundled code, the location-service layer group is a module-level constant:
Uq walks node.dependencies and hits, in chunk-36bwgd4p.js:
resolve: (a)=>s.get(a.name)??a// a === undefined
So one entry of a deps: [...] array inside e8's graph is undefined at module-eval time. A stale/undefined binding from a circular chunk import would produce exactly this, and would also explain why only the bun bundle is affected while the Node bundle of the same commit is fine.
Net effect: the location runtime never boots, so SystemPrompt.environment throws and no prompt ever reaches a model.
MacOS, same issue. After lots of troubleshooting, uninstalling the Homebrew maintained formula with brew uninstall opencode and Installing from the recommended tap with brew install anomalyco/tap/opencode resolved this issue for me. Running 1.18.30 just fine now. Uninstalling did not touch my config or session data.
Reacted by Jan Rabe, WZHMAT1, Eugene Hong, Yazdan Mohammadi, Gerard Montes, Michael Chang, Rajesh Hegde, Nitya Sunkad, Bastien, Greg and 12 more
Reacted by Jan Rabe, Michael Chang, abavoil, Raphael Caldas, moreindirection, alx-ul and Anthony J
MacOS, same issue. After lots of troubleshooting, uninstalling the Homebrew maintained formula with brew uninstall opencode and Installing from the recommended tap with brew install anomalyco/tap/opencode resolved this issue for me. Running 1.18.30 just fine now. Uninstalling did not touch my config or session data.
that is because a new version is installed:
❯ brew uninstall opencode
Uninstalling /opt/homebrew/Cellar/opencode/1.18.30_1... (7 files, 143.2MB)
❯ brew install anomalyco/tap/opencode
==> Tapping anomalyco/tap
Cloning into '/opt/homebrew/Library/Taps/anomalyco/homebrew-tap'...
Tapped 1 cask and 3 formulae (16 files, 1.4MB).
==> Trusted formula anomalyco/tap/opencode
==> Would install 1 formula:
opencode
==> Fetching downloads for: opencode
✔︎ Formula opencode (1.18.31) Verified 46.3MB/ 46.3MB
==> Installing opencode from anomalyco/tap
🍺 /opt/homebrew/Cellar/opencode/1.18.31: 4 files, 144.5MB, built in 3 seconds
I can confirm this version does not have the bug/issue
MacOS, same issue. After lots of troubleshooting, uninstalling the Homebrew maintained formula with brew uninstall opencode and Installing from the recommended tap with brew install anomalyco/tap/opencode resolved this issue for me. Running 1.18.30 just fine now. Uninstalling did not touch my config or session data.
In MacOS, I can confirm that this solution works. Great work @DanCanCos 🥇
Activity
github-actions commentedon Sep 12, 2026
This issue might be a duplicate of existing issues. Please check:
TypeError: undefined is not an object (evaluating 'a.name')inSystemPrompt.environmenton v1.18.30, reproduces on every prompt with a clean config/home, identical stack trace.fabriziomartini commentedon Sep 13, 2026
Confirming this on macOS via Homebrew too. Same crash:
TypeError: undefined is not an object (evaluating 'a.name')
Reproducible even with empty config and built-in provider —
verified it's not related to any custom provider setup.
Downgrading to 1.18.15 via npm (npm install -g [email protected])
fixes it completely.
hollodotme commentedon Sep 13, 2026
I analysed the issue with Claude, here's the summary and workaround.
opencode v1.18.30: SystemPrompt.environment crashes with TypeError: undefined is not an object (evaluating 'a.name')
Description
opencode v1.18.30 crashes when building the system prompt environment. The error occurs in the embedded v2 model catalog resolution code during nested .map() iterations, where an array element is undefined but the code expects an object with a .name property.
The error is not caused by user configuration, plugins, cache, or project state. It reproduces from any directory, even with --pure (no external plugins).
Stack trace (from ~/.local/share/opencode/log/opencode.log)
Reproduction
Proof that v1.18.29 is not affected
Workaround
If opencode was installed via brew, unlink the broken v1.18.30 and fall back to v1.18.29 installed via curl:
Environment
vilherda commentedon Sep 13, 2026
Also affected on macOS. I ran an A/B plus a build-to-build comparison that narrows this down further, so posting the data here since this is the "regression" issue.
1. The regression window is exactly one release: 1.18.29 → 1.18.30
Same machine, same
~/.config/opencode, same directory, back to back:[email protected], unpacked to a temp dir, not installed)1.18.30_1)TypeError: undefined is not an object (evaluating 'a.name')So it is not "somewhere between 1.18.18 and 1.18.30" — 1.18.29 is good and 1.18.30 is bad.
2. It is unconditional on the CLI build
Every one of these crashes identically, all with
--pure:{"$schema":"https://opencode.ai/config.json"}+ freshXDG_CONFIG_HOME/XDG_DATA_HOMERuled out: plugins (
--pure), MCP servers, LSPs, git vs non-git, and thereferencesblock from #48809 (mine is commented out).opencode agent list --puredoes not crash for me — only the prompt path does, i.e.SystemPrompt.environment.3. The bun-compiled binary is affected; the Electron build of the same 1.18.30 is not
This looks like the most useful datapoint. I have both installed:
/opt/homebrew/bin/opencode→ 1.18.30, bun single-file binary → crashes on every prompt/Applications/OpenCode.app→ 1.18.30 (Electron/Node bundle) → never crashed onceOver the exact window in which 81
level=ERRORa.namecrashes were logged from five separate CLI/TUI processes, the desktop app's server in the same shared log kept loggingbooting location servicessuccessfully for many directories, and produced zero crashes.The Electron
app.asarcontainsbooting location servicesandSystemPrompt.environmentbut zero occurrences of$bunfsorchunk-36bwgd4p— same source, different bundle. Every stack trace in this issue and in #48803 / #48811 / #48809 / #48372 is/$bunfs/root/chunk-*.js.That points at a bundling / module-initialisation artifact of the bun compile step rather than a source-level logic bug — consistent with the failure mode below. (Stated as a hypothesis; I have not bisected the source.)
4. Where it dies
From the bundled code, the location-service layer group is a module-level constant:
Uqwalksnode.dependenciesand hits, inchunk-36bwgd4p.js:So one entry of a
deps: [...]array insidee8's graph isundefinedat module-eval time. A stale/undefined binding from a circular chunk import would produce exactly this, and would also explain why only the bun bundle is affected while the Node bundle of the same commit is fine.Net effect: the location runtime never boots, so
SystemPrompt.environmentthrows and no prompt ever reaches a model.Environment
1.18.30_1chunk-36bwgd4p.jsReproduction
1.18.30 →
a.nameinSystemPrompt.environment. 1.18.29 →PONG.DanCanCos commentedon Sep 14, 2026
MacOS, same issue. After lots of troubleshooting, uninstalling the Homebrew maintained formula with
brew uninstall opencodeand Installing from the recommended tap withbrew install anomalyco/tap/opencoderesolved this issue for me. Running 1.18.30 just fine now. Uninstalling did not touch my config or session data.jgrecu commentedon Sep 15, 2026
that is because a new version is installed:
❯ brew uninstall opencode
Uninstalling /opt/homebrew/Cellar/opencode/1.18.30_1... (7 files, 143.2MB)
❯ brew install anomalyco/tap/opencode
==> Tapping anomalyco/tap
Cloning into '/opt/homebrew/Library/Taps/anomalyco/homebrew-tap'...
Tapped 1 cask and 3 formulae (16 files, 1.4MB).
==> Trusted formula anomalyco/tap/opencode
==> Would install 1 formula:
opencode
==> Fetching downloads for: opencode
✔︎ Formula opencode (1.18.31) Verified 46.3MB/ 46.3MB
==> Installing opencode from anomalyco/tap
🍺 /opt/homebrew/Cellar/opencode/1.18.31: 4 files, 144.5MB, built in 3 seconds
I can confirm this version does not have the bug/issue
DanCanCos commentedon Sep 15, 2026
1.18.31 was released after this comment was made, but I'm glad the new version is working for you.
$ brew info opencode ==> opencode ✔: stable 1.18.30Xyz00777 commentedon Sep 15, 2026
can confirm still broken in 1.18.31 (at least on nixos).
fabriziomartini commentedon Sep 15, 2026
Confirming 1.18.31 fixes this on macOS via npm as well (not just via the Homebrew tap mentioned above).
Tested in isolation first with the curl-based upgrade (~/.opencode/bin/opencode), before touching the global install:
Then made it permanent:
npm install -g --allow-scripts=opencode-ai [email protected]
opencode --version → 1.18.31
opencode run "ciao" → works fine
macOS, npm-managed install (not Homebrew).
creativecomposer commentedon Sep 17, 2026
In MacOS, I can confirm that this solution works. Great work @DanCanCos 🥇
chore(nix): bump nixpkgs to pick up opencode 1.18.31
fix(opencode): build 1.18.31 without bun code splitting
Follow OpenCode as a built-in agent