Skip to content

Desktop renderer crashes when session/command lists are object maps #35551

Description

@megamen32

Summary

The desktop renderer crashes when persisted/store/API list fields are returned as object maps instead of arrays.

Observed on macOS OpenCode Desktop 1.17.13 with the packaged renderer asset oc://renderer/assets/main-C--ziyJW.js.

This appears to affect at least:

  • store.session / session list handling
  • response.data from session.list()
  • sync().data.command from command.list()

Actual behavior

The app opens to the error page and the renderer logs a fatal error.

First crash:

[2026-07-06 14:21:33.544] [error] (renderer) fatal renderer error {
  error: 'TypeError: (store2.session ?? []).filter is not a function\n' +
    '    at roots (oc://renderer/assets/main-C--ziyJW.js:103229:50)\n' +
    '    at Array.flatMap (<anonymous>)\n' +
    '    at latestRootSession (oc://renderer/assets/main-C--ziyJW.js:103231:52)\n' +
    '    at navigateToProject (oc://renderer/assets/main-C--ziyJW.js:111886:21)\n' +
    '    at async oc://renderer/assets/main-C--ziyJW.js:111318:7',
  url: 'oc://renderer/index.html',
  version: '1.17.13',
  platform: 'desktop',
  os: 'macos'
}

Related repeated log lines:

Failed to load sessions TypeError: (x2.data ?? []).filter is not a function

After locally normalizing session values in the renderer bundle, the next incompatible list field showed up:

[2026-07-06 15:52:58.071] [error] (renderer) fatal renderer error {
  error: 'TypeError: sync2(...).data.command.map is not a function\n' +
    '    at Object.fn (oc://renderer/assets/main-C--ziyJW.js:131047:41)\n' +
    '    at runComputation (oc://renderer/assets/main-C--ziyJW.js:487:22)\n' +
    '    at updateComputation (oc://renderer/assets/main-C--ziyJW.js:470:3)\n' +
    '    at runTop (oc://renderer/assets/main-C--ziyJW.js:566:7)\n' +
    '    at runQueue (oc://renderer/assets/main-C--ziyJW.js:638:45)\n' +
    '    at completeUpdates (oc://renderer/assets/main-C--ziyJW.js:594:5)\n' +
    '    at runUpdates (oc://renderer/assets/main-C--ziyJW.js:584:5)\n' +
    '    at batch (oc://renderer/assets/main-C--ziyJW.js:265:10)\n' +
    '    at setStore (oc://renderer/assets/main-C--ziyJW.js:50387:5)\n' +
    '    at oc://renderer/assets/main-C--ziyJW.js:74976:70\n' +
    '    at async retry (oc://renderer/assets/main-C--ziyJW.js:72440:14)',
  url: 'oc://renderer/index.html',
  version: '1.17.13',
  platform: 'desktop',
  os: 'macos'
}

Expected behavior

Renderer code should tolerate both SDK list shapes:

  • arrays: [item, ...]
  • object maps: { "id": item, ... }

and normalize before calling .filter(), .map(), .find(), Binary.search(), or trimSessions().

Local validation

I patched the packaged renderer locally to normalize array-or-record values before using them as arrays. After that, the newest renderer log no longer contains:

fatal renderer error
filter is not a function
map is not a function
find is not a function
store2.session
Failed to load sessions

and the desktop app reaches server ready:

[2026-07-06 15:54:12.063] [info] server ready { url: 'http://127.0.0.1:52470' }

Proposed fix

Normalize array-or-record fields in the app source before list operations, especially session and command lists used by desktop startup/navigation.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions