Skip to content

desktop: fatal 'Expected a user-message timeline row' when a virtualized row changes type #62800

Description

@bermuda99

Summary

On OpenCode Desktop 2.2.6 (Windows), the renderer throws a fatal error and the app must be restarted:

Error: Expected a user-message timeline row

The error comes from packages/session-ui/src/timeline/session-timeline-row.tsx. It appears to happen when a virtualized timeline row changes type under an existing row key, and a cleanup path re-reads the reactive row accessor after the type changed.

Environment

  • opencode version: 2.2.6 (Desktop, bundled CLI 2.2.6; opencode 2.1.4 is also on PATH)
  • OS: Windows 11 Home 10.0.26200 (build 26200), 64-bit
  • Terminal: Desktop app (no terminal)
  • Shell: PowerShell 5.1 / cmd
  • Install/channel: packaged desktop app (ai.opencode.desktop), latest; updater reports 2.2.6 is the latest version
  • Active plugins: opencode-goal-plugin@0.11.0, superpowers@git+https://github.com/obra/superpowers.git, @bybrawe/opencode-loop@0.6.9, @bybrawe/opencode-goal@1.3.49. Probably unrelated: the crash is in core session UI code.

Reproduction

Intermittent; observed once. The affected session was long-running (~3.8k stored messages, 15 compactions) and was streaming when the crash happened. The exact UI action at that moment is unknown, but the crash occurred during a timeline update.

Likely steps:

  1. Open a long session in Desktop.
  2. While the timeline is virtualized, cause a row key to disappear or change type under an existing virtual item: send a message, undo/remove a message, let auto-compaction land, or load older history.
  3. The renderer throws and the app shows the fatal error screen.

Expected Behavior

The timeline re-renders the new row set without a fatal error. At most, a row should be replaced or briefly show a placeholder.

Actual Behavior

Fatal renderer error in the desktop log:

[2026-11-09 02:01:28.316] [error] (renderer) fatal renderer error {
  error: 'Error: Expected a user-message timeline row\n' +
    '    at t (oc://renderer/assets/route-n9fMH66W.js:24:60066)\n' +
    '    at get row (oc://renderer/assets/route-n9fMH66W.js:24:60362)\n' +
    '    at oc://renderer/assets/route-n9fMH66W.js:24:52896\n' +
    '    at Array.<anonymous> (oc://renderer/assets/route-n9fMH66W.js:24:67875)\n' +
    '    at nt (oc://renderer/assets/main-PFC26dD0.js:2:13277)\n' +
    '    at nt (oc://renderer/assets/main-PFC26dD0.js:2:13190)\n' +
    '    at nt (oc://renderer/assets/main-PFC26dD0.js:2:13190)\n' +
    '    at nt (oc://renderer/assets/main-PFC26dD0.js:2:13190)\n' +
    '    at oc://renderer/assets/main-PFC26dD0.js:2:3079\n' +
    '    at P (oc://renderer/assets/main-PFC26dD0.js:2:6603)\n' +
    '    at Array.<anonymous> (oc://renderer/assets/main-PFC26dD0.js:2:3073)\n' +
    '    at oc://renderer/assets/main-PFC26dD0.js:2:15846\n' +
    '    at P (oc://renderer/assets/main-PFC26dD0.js:2:6652)\n' +
    '    at Object.fn (oc://renderer/assets/main-PFC26dD0.js:2:15266)\n' +
    '    at Ke (oc://renderer/assets/main-PFC26dD0.js:2:9618)\n' +
    '    at Ge (oc://renderer/assets/main-PFC26dD0.js:2:9389)\n' +
    '    at Je (oc://renderer/assets/main-PFC26dD0.js:2:11030)\n' +
    '    at Ze (oc://renderer/assets/main-PFC26dD0.js:2:11907)\n' +
    '    at Xe (oc://renderer/assets/main-PFC26dD0.js:2:11304)\n' +
    '    at Ye (oc://renderer/assets/main-PFC26dD0.js:2:11211)\n' +
    '    at Je (oc://renderer/assets/main-PFC26dD0.js:2:11088)\n' +
    '    at Ze (oc://renderer/assets/main-PFC26dD0.js:2:11907)\n' +
    '    at Xe (oc://renderer/assets/main-PFC26dD0.js:2:11304)\n' +
    '    at Ye (oc://renderer/assets/main-PFC26dD0.js:2:11211)\n' +
    '    at we (oc://renderer/assets/main-PFC26dD0.js:2:6555)\n' +
    '    at oc://renderer/assets/main-PFC26dD0.js:698:112100\n' +
    '    at i (oc://renderer/assets/esm-rub_JZLD.js:15:6665)',
  url: 'oc://renderer/index.html',
  version: '2.2.6',
  platform: 'desktop',
  os: 'windows'
}

The app restarted about 8 seconds later. No data loss was observed; the session continued on the server.

Additional Context

Root-cause analysis against the v2.2.6 source (the file is unchanged on dev as of this report):

  • packages/app/src/session/timeline/virtualizer.tsx (VirtualRow, around line 1059):

    const row = createMemo(() => rowByKey().get(rowProps.rowKey) ?? rows()[item().index] ?? initialRow)

    When a keyed row disappears or the map shifts, this falls back to the row at the virtual item's index. That row can have a different _tag than initialRow, even though the component still holds the old key.

  • packages/session-ui/src/timeline/session-timeline-row.tsx (render, around line 1070):

    const current = () => {
      const value = row()
      if (!Predicate.isTagged(value, "UserMessage")) throw new Error("Expected a user-message timeline row")
      return value
    }

    Row dispatches once via <Show when={TimelineRow.key(props.row())} keyed>, but branch helpers such as current() re-read the reactive row(). If the row type changes during an update, a cleanup path (for example growIn's onCleanup -> grown(props.row.userMessageID) in Frame) evaluates props.row after row() has already fallen back to the index row. The guard throws, and Solid's error boundary treats it as fatal.

  • Suggested minimal fix: do not fall back to rows()[item().index] for a keyed virtual row. Use the keyed row or the captured initialRow, and skip synthetic removed:* keys. Alternatively, make each branch's current() helper non-throwing by returning the last same-tag row. A regression test should replace a UserMessage row with a non-user row at the same virtual index while the row is mounted.

No existing issue was found for this error string. The crash is intermittent; the full renderer log can be provided if useful.

Activity

  1. bermuda99 commented on Nov 9, 2026

    @bermuda99
    Author

    totally not created with ai

  2. opencodejr commented on Nov 9, 2026

    @opencodejr
    Contributor

    Thanks for the detailed analysis. I could reproduce this crash.

    The desktop app doesn't run in our sandbox, so I reproduced it with a component test. It renders the real session-ui timeline row renderer, compiled with Solid's compiler, and gives the row the same accessor VirtualRow uses (rowByKey().get(key) ?? rows()[index] ?? initialRow):

    1. While the session is busy, a new user message (a steer) arrives, and its row mounts and grows in.
    2. The message list changes so that row's key disappears and an assistant-part row now sits at the same index (as after an undo or a compaction landing).
    3. The keyed <Show> in Row disposes the old branch. growIn's onCleanup calls grown(props.row.userMessageID), which re-reads the row accessor, and current() throws Error: Expected a user-message timeline row. The stack matches your log.

    It fails the same way on v2.2.6 and on the latest dev (6973d89). The script below reproduces it (run bun install in an opencode checkout first).

    Reproduction script (repro.sh)
    #!/usr/bin/env bash
    # Reproduces anomalyco/opencode#62800 against an opencode checkout (default /workspace/repo; run `bun install` there first).
    # Mounts the real session-ui row renderer with the same row accessor shape VirtualRow uses
    # (rowByKey().get(key) ?? rows()[index] ?? initialRow), lets a steer user message grow in,
    # then replaces it with assistant rows at the same index. Compiles TSX with Solid's real
    # babel compiler (DOM mode), as the desktop build does.
    set -euo pipefail
    REPO=${1:-/workspace/repo}
    HERE=$(cd "$(dirname "$0")" && pwd)
    PKG=$REPO/packages/session-ui
    B=$REPO/node_modules/.bun
    core=$(ls -d $B/@babel+core@*/node_modules/@babel/core | head -1)
    solid=$(ls -d $B/babel-preset-solid@*/node_modules/babel-preset-solid | tail -1)
    ts=$(ls -d $B/@babel+preset-typescript@*/node_modules/@babel/preset-typescript | head -1)
    cat > /tmp/solid-babel-62800.ts <<TS
    import { plugin } from "bun"
    const babel = require("$core")
    plugin({ name: "solid-babel", setup(build) {
      build.onLoad({ filter: /\.tsx\$/ }, async (args) => ({
        contents: babel.transformSync(await Bun.file(args.path).text(), { filename: args.path,
          presets: [["$solid", { generate: "dom", hydratable: false }], ["$ts", { onlyRemoveTypeImports: false }]] }).code,
        loader: "js" })) } })
    TS
    cp "$HERE/repro-62800-harness.tsx" "$HERE/repro-62800.test.ts" "$PKG/src/timeline/"
    cp "$PKG/bunfig.toml" /tmp/bunfig-62800.bak
    trap 'cp /tmp/bunfig-62800.bak "$PKG/bunfig.toml"; rm -f "$PKG/src/timeline/repro-62800-harness.tsx" "$PKG/src/timeline/repro-62800.test.ts"' EXIT
    printf '[test]\npreload = ["/tmp/solid-babel-62800.ts"]\n' > "$PKG/bunfig.toml"
    cd "$PKG" && bun test --conditions=browser src/timeline/repro-62800.test.ts

    Run it: bash repro.sh

  3. jimmyallinai commented on Nov 9, 2026

    @jimmyallinai
    Contributor

    I'll take a look at this. My plan: reproduce the crash with the component test from the bot's comment (the VirtualRow row-accessor shape), then fix the stale re-read so a row whose key disappeared can't throw Expected a user-message timeline row from a cleanup path after its type changed, and verify with that reproduction test plus the neighbouring session-ui timeline tests and typecheck.

  4. added a commit that references this issue on Nov 9, 2026
    af1f6a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions