Skip to content

Regression in 1.18.30: every prompt crashes with TypeError in SystemPrompt.environment ("a.name") — 1.18.18 works fine #48645

Closed

Description

@Syntaxri

Description

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

  1. Install/update to opencode 1.18.30 on Arch Linux (official pacman package, not AUR)
  2. Run opencode in any directory
  3. Send any prompt, e.g. "hello"
  4. Observe: "Failed to send prompt. Unexpected server error. Check server logs for details."
  5. Check ~/.local/share/opencode/log/ — see the TypeError above in SystemPrompt.environment
  6. 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)

Activity

  1. github-actions commented on Sep 12, 2026

    @github-actions
    Contributor

    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.
  2. fabriziomartini commented on Sep 13, 2026

    @fabriziomartini

    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.

  3. hollodotme commented on Sep 13, 2026

    @hollodotme

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

    Stack trace (from ~/.local/share/opencode/log/opencode.log)

      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
  4. vilherda commented on Sep 13, 2026

    @vilherda

    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:

    Version Result
    1.18.29 ([email protected], unpacked to a temp dir, not installed) ✅ prompt completes normally
    1.18.30 (Homebrew bottle 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:

    Config Directory Result
    my real config non-git dir crash
    my real config git repo crash
    stock {"$schema":"https://opencode.ai/config.json"} + fresh XDG_CONFIG_HOME/XDG_DATA_HOME non-git dir crash
    stock + fresh XDG git repo crash

    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=ERROR a.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:

    // chunk-rbqz2b3d.js
    var e8 = Gh([rc, jB, OA, h2, t7, eB, T2, qE, /* ... */ , C_]);
    
    function Jv(e = []) {
      return J(os, l6((t) => {
        let n = e.concat([[rc, Tq(t)]]),
            i = Uq(e8, Wp.values.global, n);          // <-- hoist tagged layers
        return U2(i.node).pipe(ak, MF(() => Se("booting location services", {...})), dt(U2(i.hoisted)))
      }, { idleTimeToLive: "60 minutes" }))
    }

    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.

    Environment

    • macOS 26.6.2 (build 25G83), Darwin 25.6.0, arm64
    • opencode 1.18.30, Homebrew bottle 1.18.30_1
    • Crashing chunk in this build: chunk-36bwgd4p.js
    • Workaround in use: run 1.18.29

    Reproduction

    BASE=$(mktemp -d); mkdir -p "$BASE/cfg/opencode" "$BASE/data/opencode" "$BASE/dir"
    cp ~/.local/share/opencode/auth.json "$BASE/data/opencode/"
    printf '{"$schema":"https://opencode.ai/config.json"}' > "$BASE/cfg/opencode/opencode.json"
    cd "$BASE/dir" && XDG_CONFIG_HOME="$BASE/cfg" XDG_DATA_HOME="$BASE/data" \
      opencode run --pure --print-logs "say PONG"

    1.18.30 → a.name in SystemPrompt.environment. 1.18.29 → PONG.

  5. DanCanCos commented on Sep 14, 2026

    @DanCanCos

    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.

  6. jgrecu commented on Sep 15, 2026

    @jgrecu

    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

  7. DanCanCos commented on Sep 15, 2026

    @DanCanCos

    that is because a new version is installed

    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.30
  8. Xyz00777 commented on Sep 15, 2026

    @Xyz00777

    can confirm still broken in 1.18.31 (at least on nixos).

  9. fabriziomartini commented on Sep 15, 2026

    @fabriziomartini

    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:

    • opencode run --pure "say PONG" → PONG (no crash)
    • Real config with a custom OpenAI-compatible provider, tool calling (date command), and longer prompts → all working correctly

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

  10. creativecomposer commented on Sep 17, 2026

    @creativecomposer

    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 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions