Skip to content

tui: /btw crashes when rendering answer dialog #49777

Closed

Description

@stevoland

Stop letting @thdxr push :)

Summary

Running the built-in /btw slash command crashes the TUI after the generated answer is returned. The answer dialog attempts to access PluginProvider outside its context boundary.

Environment

  • opencode version: 2.0.8
  • OS: macOS 25.6.0 (arm64)
  • Terminal: Ghostty 1.3.1 (TERM=xterm-ghostty, COLORTERM=truecolor)
  • Shell: /bin/zsh
  • Install/channel: latest release
  • Active plugins: No user-configured plugins; crash occurs in the built-in opencode.btw plugin

Reproduction

  1. Open an existing session in the TUI.
  2. Enter /btw <question>.
  3. Wait for the generated answer.

The issue reproduces consistently.

Expected Behavior

The generated answer should appear in the /btw dialog without modifying the session history.

Actual Behavior

The TUI displays its crash screen with:

Error: PluginProvider is missing

The stack trace originates from Answer in the built-in /btw plugin.

Additional Context

The issue has been reproduced with a fixture-driven TUI test that invokes /btw, returns a generated answer, and observes the same crash screen.

The cause appears to be a provider-boundary mismatch:

  • PluginProvider is mounted beneath DialogProvider.
  • DialogProvider renders dialog elements alongside its children, outside the child PluginProvider subtree.
  • The /btw Answer component calls the host TUI's usePlugin() hook to obtain markdown renderers.
  • Consequently, rendering the answer dialog throws PluginProvider is missing.

A narrow fix is to read the markdown renderer while the plugin's app slot is mounted beneath PluginProvider, then pass that renderer into the answer dialog rather than calling usePlugin() inside the dialog.

Activity

  1. cestercian commented on Sep 18, 2026

    @cestercian
    Contributor

    Looking into this — planning to fix the /btw answer dialog so it renders inside PluginProvider (or otherwise avoids the out-of-context access).

  2. patrickzxk commented on Sep 18, 2026

    @patrickzxk

    Confirming the same crash on a different environment (macOS), for extra coverage.

    Environment

    • opencode version: 2.0.8
    • OS: macOS 27.0.0 (arm64)
    • Terminal: Ghostty 1.3.1 (TERM=xterm-256color, COLORTERM=truecolor)
    • Shell: /bin/zsh
    • Install/channel: latest release
    • Active plugins: one local plugin (opencode2-quota); the crash occurs in the built-in opencode.btw plugin, not the user plugin

    Reproduction

    1. Open an existing session in the TUI.
    2. Run /btw <question>.
    3. Once the generated answer returns, the TUI shows the crash screen.

    Reproduces every time — not intermittent.

    Actual behavior

    Error: PluginProvider is missing
        at sc (/$bunfs/root/chunk-78sbr86b.js:2593:2804)
        at Qc (/$bunfs/root/chunk-3y6z3143.js:4:248)
        at Xn (/$bunfs/root/chunk-p4ydqyaa.js:2:7348)
        at children (/$bunfs/root/chunk-78sbr86b.js:2590:118420)
        ...
    

    The top frame is at chunk-78sbr86b.js:2593:2804, which matches the offset in #49790 (chunk-vbstx86m.js:2593:2804) — only the build hash differs. So this is the same usePlugin()-outside-PluginProvider path as described here. The root-cause analysis above (PluginProvider mounted beneath DialogProvider, while dialogs render outside the child subtree) is consistent with what we see.

  3. kyeshmz commented on Sep 18, 2026

    @kyeshmz

    Confimred with Wezterm as welll on macOs latest and opencode 2.0.8

  4. Asura7170 commented on Sep 19, 2026

    @Asura7170

    Same crash on Windows, confirming cross-platform repro: opencode 2.0.8, Windows 10.0.26200 (x64), WarpTerminal. Ran /btw while the agent was still working, TUI crashed with Error: PluginProvider is missing. Stack matches offset-for-offset (chunk-qp8tk0rb.js:2593:2804), only the chunk hash differs by platform, same as #49790.

  5. stevoland commented on Sep 19, 2026

    @stevoland
    ContributorAuthor

    Fixed in 2.0.9 thx

  6. brettanthonysjoberg179-lab commented on Sep 27, 2026

    @brettanthonysjoberg179-lab

    One more environment data point, plus a root-cause detail that may be useful for the fix.

    New repro not yet covered here: Linux x64, and zero plugins configured.

    • opencode version: 2.0.8
    • OS: Linux 6.6.141-09476-g954adab60416 (linux x64)
    • Terminal: TERM=xterm-256color, no COLORTERM / TERM_PROGRAM
    • Shell: /bin/bash
    • Install/channel: latest release
    • Active plugins: none — no plugin key in opencode.jsonc, no .opencode/plugin(s)/ directory

    The existing confirmations in this thread (macOS x2, Windows) either had a local plugin installed or didn't state plugin state. This reproduces with an empty plugin configuration, which confirms the failure is entirely independent of user plugins — PluginProvider is internal to opencode.

    The stack matches offset-for-offset (chunk-vbstx86m.js:2593:2804, caller chunk-x0cbprj9.js:4:248), only the chunk hash differing.

    One detail from the bundle that may be relevant to the fix. The accessor is called unconditionally at the top of the /btw dialog component body, not inside a lazy computation:

    // throw site
    function sa(){let t=Xn(ZW);if(!t)throw Error("PluginProvider is missing");return t}
    
    // caller — /btw answer dialog
    function Uc(t){let r=Je(),o=Vt(),i=QH(),u=sa(),l=He("elevated"),m=He("overlay"),...

    Because the read happens during component setup, it throws on render regardless of whether any plugin is installed. There are 11 call sites of this accessor across the TUI bundle, so any of them rendered outside the provider would fail identically — the fix may want to check the full set rather than just the /btw dialog.

    (Confirmed already fixed in 2.0.9 per the closing note — posting only to add the Linux / no-plugin coverage.)

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

Metadata

Metadata

Assignees

No one assigned

    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