anomalyco / anomalyco/opencode
opentui: fatal: null is not an object (evaluating 's().tailHygiene')
@kommander is already working on this.
Since Sep 10, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- Avg merge
- 7h 2m
- Merged PRs (30d)
- 384
Description
Description
Description
Switching sessions via ctrl+x l crashes the TUI sidebar. setSnapshot(null) fires on session switch and s() returns null until async refresh completes.
Root cause
In packages/plugin/src/tui/slots/sidebar-content.tsx:
- Line 698:
setSnapshot(null)fires on session switch (createEffect(on(props.sessionID, ...))). - Line 720:
const s = createMemo(() => snapshot()) — s()returnsnullafter the switch, untilrefresh()completes its asyncloadSidebarSnapshotcall. - Line 809:
{s()!.tailHygiene !== undefined && (— uses the TypeScript non-null assertion!, which is compile-time only. At runtime,s()is null, sos().tailHygienethrows.
The SolidJS compiled nested memo at line 866 (_$memo(() => s().tailHygiene !== undefined)) can re-evaluate after s() has already become null but before the outer guard's effect unmounts the inner content. Every other s() access in the file uses s()?. or is wrapped in a s() && ... guard. The tail-hygiene block is the only unguarded access.
Potential fix
- {s()!.tailHygiene !== undefined && (
+ {s()?.tailHygiene !== undefined && (
Lines 813–814 (s()!.tailHygiene!) are inside that guard so ! is safe once the condition is fixed.
Environment
- Plugin: v0.41.4
- OS: darwin arm64
- Node: v24.2.0
- OpenCode: 1.15.6
Configuration
Config from ~/.config/cortexkit/magic-context.jsonc:
{
"$schema": "https://raw.githubusercontent.com/cortexkit/magic-context/master/assets/magic-context.schema.json",
"historian": {
"opencode": {
"model": "corti/corti-s1-mini"
}
},
"dreamer": {
"opencode": {
"model": "corti/corti-s1"
}
},
"sidekick": {
"model": "corti/corti-s1-mini"
}
}
Error trace
Error: null is not an object (evaluating 's().tailHygiene')
at <anonymous> (/Users/jdh/.cache/opencode/packages/@cortexkit/opencode-magic-context@latest/node_modules/@cortexkit/opencode-magic-context/src/tui-compiled/slots/sidebar-content.tsx:866:37)
at sd (/$bunfs/root/chunk-fcdn7z64.js:2:11235)
at oa (/$bunfs/root/chunk-fcdn7z64.js:2:11016)
at qa (/$bunfs/root/chunk-fcdn7z64.js:2:12814)
at Wd (/$bunfs/root/chunk-fcdn7z64.js:2:13729)
at Vg (/$bunfs/root/chunk-fcdn7z64.js:2:13091)
at j (/$bunfs/root/chunk-fcdn7z64.js:2:12995)
at Vg (/$bunfs/root/chunk-fcdn7z64.js:2:13623)
at j (/$bunfs/root/chunk-fcdn7z64.js:2:12995)
at l (/$bunfs/root/chunk-fcdn7z64.js:3:160394)
at navigate (/$bunfs/root/chunk-cdy7d0x6.js:466:7799)
at onSelect (/$bunfs/root/chunk-cdy7d0x6.js:489:36199)
at I (/$bunfs/root/chunk-cdy7d0x6.js:470:10316)
at j (/$bunfs/root/chunk-yhqshqbk.js:2:32046)
at runBinding (/$bunfs/root/chunk-yhqshqbk.js:2:34471)
at _J (/$bunfs/root/chunk-yhqshqbk.js:2:54932)
at VJ (/$bunfs/root/chunk-yhqshqbk.js:2:49037)
at TJ (/$bunfs/root/chunk-yhqshqbk.js:2:47585)
at wJ (/$bunfs/root/chunk-yhqshqbk.js:2:46755)
at <anonymous> (/$bunfs/root/chunk-yhqshqbk.js:2:68234)
at emitWithPriority (/$bunfs/root/chunk-vtv1c1d6.js:3:32592)
at processParsedKey (/$bunfs/root/chunk-vtv1c1d6.js:3:32061)
at handleStdinEvent (/$bunfs/root/chunk-vtv1c1d6.js:62:5000)
at <anonymous> (/$bunfs/root/chunk-vtv1c1d6.js:62:4869)
at drain (/$bunfs/root/chunk-vtv1c1d6.js:33:7440)
at drainStdinParser (/$bunfs/root/chunk-vtv1c1d6.js:62:4841)
at <anonymous> (/$bunfs/root/chunk-vtv1c1d6.js:62:2698)
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)...
Plugins
magic-context, aft
OpenCode version
1.15.6
Steps to reproduce
- Run Opencode
- Have multiple active sessions
- Change between sessions with
ctrl+x l - Repeat 3 until failure (usually less than five session switches)
Screenshot and/or share link
Operating System
macos 26.6.2
Terminal
iTerm2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.