Repository navigation
Closed
Labels
Description
Summary
Setting cursor.style to "block" (with cursor.blinking: true) in ~/.config/opencode/cli.json crashes the TUI with TypeError: undefined is not an object (evaluating 'e.color') inside cursorStyle. Removing the cursor override stops the crash; cursor.style: "line" worked.
Environment
- opencode version: 2.1.4
- OS: Ubuntu 24.04 on WSL2, kernel
6.18.33.2-microsoft-standard-WSL2(x86_64) - Terminal: Windows Terminal Preview 1.26; inside WSL
TERM=xterm-256color,TERM_PROGRAMandCOLORTERMare unset - Shell:
/bin/bash - Install/channel: npm global via nvm (
@opencode/cli2.1.4), release - Active plugins:
skill-guard(local),omniroute-opencode-plugin-v2(local)
Reproduction
- In
~/.config/opencode/cli.json, set:The previous value was"cursor": { "style": "block", "blinking": true }
"style": "line", which did not crash. - Let the TUI hot-reload the config (no restart was needed).
- The TUI crashes shortly afterward, on a cursor render/update.
Removing the cursor block and hot-reloading restores the TUI.
Frequency: observed once; I reverted the setting to avoid another crash, so I did not re-test. The crash appeared within ~1-2 minutes of the change.
Expected Behavior
The block cursor should render without crashing.
Actual Behavior
TypeError: undefined is not an object (evaluating 'e.color')
at cursorStyle (/$bunfs/root/chunk-sm21dtbc.js:187:2076)
at setProperty (/$bunfs/root/chunk-k8fpjnkk.js:3:8290)
at setProp (/$bunfs/root/chunk-k8fpjnkk.js:3:4269)
at <anonymous> (/$bunfs/root/chunk-4r2qsk0b.js:36:4956)
at Fe (/$bunfs/root/chunk-aaw6zawx.js:2:9876)
at K (/$bunfs/root/chunk-aaw6zawx.js:2:9657)
at Z (/$bunfs/root/chunk-aaw6zawx.js:2:11342)
at xt (/$bunfs/root/chunk-aaw6zawx.js:2:12450)
at j (/$bunfs/root/chunk-aaw6zawx.js:2:11501)
at wt (/$bunfs/root/chunk-aaw6zawx.js:2:12148)
Additional Context
- The config at crash time also had
animations: false,session.scrollbar: true,session.tps: true. The only cursor-related change wasstyle: "line"->"block"withblinking: true. - Workaround: leave
cursorunset (terminal default) or keep"style": "line". The current config has nocursorblock and the TUI is stable. cursorStyleappears to assumee.colorexists; with the default dark theme and a block cursor it is undefined. A fallback to the theme cursor/text color (or a guard) would avoid the crash.- The crash stack is from the TUI crash screen. I did not find a matching entry in
~/.local/share/opencode/log/opencode.log.
Activity
opencode-agent commentedon Oct 25, 2026
Thanks for the detailed report! I reproduced this crash on 2.1.4, with the same
undefined is not an object (evaluating 'e.color')error and the same stack. It still happens on the latestdev(15646867).In my tests,
blockitself is not the trigger. The crash happens when a hot reload changescursorfrom set to unset. Steps:"cursor": { "style": "block", "blinking": true }incli.json.cursorblock fromcli.jsonwhile the TUI is running.Switching from
linetoblock, or starting with a block cursor or with nocursorsetting at all, did not crash for me. The TUI passes the unset setting straight to the input's cursor style, and the code there doesn't handle a missing value.My guess for your case: an editor save may have left
cli.jsonbriefly incomplete or invalid. The TUI then drops the whole config on reload (see #56318), socursoris unset for that moment. I haven't confirmed this.Until it is fixed, avoid changing or removing the
cursorsetting while the TUI is running. Restart after editing it instead.The recording and screenshot below show the crash, and the script below reproduces it.
Related: #56318 (one invalid
cli.jsonfield discards the whole config), #43521 (cursor style ignored in--mini).recording.mp4
Reproduction script (drive.ts)
Run it with opencode-drive:
opencode-drive run ./drive.ts. It drivesopencodefrom yourPATH; setOC_DEVto the path of an OpenCode checkout to run that from source instead.tneemo commentedon Oct 26, 2026
I'd like to take this one. The crash comes from
resolve()returningcursor: undefinedafter a reload, which the inputs then pass straight to OpenTUI'scursorStylesetter. I have a fix that resolves an unset cursor to OpenTUI's default (block, blinking) and makes mounted inputs pick up the reloaded value, plus a regression test that mountsDialogPromptand reproduces the same stack. I can open the PR if that works for you.