anomalyco / anomalyco/opencode

TUI crash: TextBuffer is destroyed

Open
#50,017 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Version

1.18.31

OS

Windows 10.0.26200 (x64)

Terminal

unknown

Reproduce

Reported automatically from the opencode crash screen. If you can, describe what you were doing when it crashed.

(Note: the stack shows a mouse-move (onMove) triggered re-render at crash time.)

Description

The opencode TUI crashed with an unexpected error.

Error: TextBuffer is destroyed

Stack trace:

Error: TextBuffer is destroyed
    at guard (B:/~BUN/root/chunk-71qbwpd9.js:69:4440)
    at setDefaultFg (B:/~BUN/root/chunk-71qbwpd9.js:69:5855)
    at fg (B:/~BUN/root/chunk-71qbwpd9.js:72:110280)
    at setProperty (B:/~BUN/root/chunk-ndz9ht51.js:71:7830)
    at setProp (B:/~BUN/root/chunk-ndz9ht51.js:71:4192)
    at <anonymous> (C:\Users\MK\.cache\opencode\packages\opencode-sdd-engram-manage@latest\node_modules\opencode-sdd-engram-manage\dist\tui.js:223:33)
    at mJ (B:/~BUN/root/chunk-axpty0ya.js:2:9650)
    at p (B:/~BUN/root/chunk-axpty0ya.js:2:9431)
    at ZJ (B:/~BUN/root/chunk-axpty0ya.js:2:11057)
    at vZ (B:/~BUN/root/chunk-axpty0ya.js:2:12168)
    at w (B:/~BUN/root/chunk-axpty0ya.js:2:11226)
    at yZ (B:/~BUN/root/chunk-axpty0ya.js:2:11863)
    at w (B:/~BUN/root/chunk-axpty0ya.js:2:11238)
    at e (B:/~BUN/root/chunk-de283808.js:2:113598)
    at set (B:/~BUN/root/chunk-de283808.js:2:122135)
    at onMove (B:/~BUN/root/chunk-redva76r.js:9:1833)
    at K (B:/~BUN/root/chunk-kxyn8gc0.js:2:29209)
    at Q (B:/~BUN/root/chunk-kxyn8gc0.js:2:29113)
    at run (B:/~BUN/root/chunk-kxyn8gc0.js:2:30092)
    at Y (B:/~BUN/root/chunk-369xv06d.js:2:33829)
    at runBinding (B:/~BUN/root/chunk-369xv06d.js:2:36254)
    at _J (B:/~BUN/root/chunk-369xv06d.js:2:56789)
    at HJ (B:/~BUN/root/chunk-369xv06d.js:2:50894)
    at wJ (B:/~BUN/root/chunk-369xv06d.js:2:49442)
    at EJ (B:/~BUN/root/chunk-369xv06d.js:2:48612)
    at <anonymous> (B:/~BUN/root/chunk-369xv06d.js:2:70091)
    at emitWithPriority (B:/~BUN/root/chunk-71qbwpd9.js:26:10165)
    at processParsedKey (B:/~BUN/root/chunk-71qbwpd9.js:26:9634)
    at handleStdinEvent (B:/~BUN/root/chunk-71qbwpd9.js:93:5055)
    at <anonymous> (B:/~BUN/root/chunk-71qbwpd9.js:93:4924)
    at drain (B:/~BUN/root/chunk-71qbwpd9.js:32:8396)
    at drainStdinParser (B:/~BUN/root/chunk-71qbwpd9.js:93:4896)
    at <anonymous> (B:/~BUN/root/chunk-71qbwpd9.js:93:2753)
    at emit (node:events:95:22)
    at addChunk (internal:streams/readable:264:47)
    at readableAddChunkPushByteMode (internal:streams/readable:242:18)
    at internalRead (native)
    at processTicksAndRejections (native)
Additional context (local investigation)
  • The crash originates in the third-party plugin opencode-sdd-engram-manage (dist/tui.js:223): its ActiveModelBadge effect sets the fg prop on a text element whose TextBuffer was already destroyed during a conditional unmount (Show wrapper), after a mouse-move triggered re-render.
  • opentui core TextBuffer.guard throws when _destroyed=true; the effect appears to run after unmount (lifecycle race between the render effect and the Show condition toggling false).
  • Disclosure: the 1.18.31 binary in use is a custom build (d7a921e41e = upstream plus local experimental TUI perf changes: VirtualList recycle/dispose). Those changes only dispose BoxRenderable refs in VirtualList's own itemRefs map (packages/tui/src/component/virtual-list.tsx:66-79) — plugin components render in separate UI slots and never enter that map, so they look unrelated to this crash.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the crash stack and the plugin entry at opencode-sdd-engram-manage/dist/tui.js:223, then inspect the conditional rendering and mouse-move path described in the report. Compare this with packages/tui/src/component/virtual-list.tsx:66-79 to confirm whether VirtualList disposal is involved. Done means reproducing the TextBuffer destruction crash and establishing a verified fix or a clear upstream/plugin ownership boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.