Skip to content

Desktop UI crashes on load with Cannot read properties of undefined (reading 'id') in session bundle #16459

Closed

Description

@cyberprophet

Summary

I hit the same crash twice today on OpenCode Desktop/Web UI startup. The app shows the black "Something went wrong" screen before the main UI finishes loading.

Version

  • OpenCode: 1.2.20

Actual Behavior

The app crashes during load with:

TypeError: Cannot read properties of undefined (reading id)
    at Object.fn (http://127.0.0.1:4096/assets/session-CiCXhYTR.js:14:79062)
    at Mk (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:6835)
    at Pl (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:6592)
    at op (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:8002)
    at D6 (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:8883)
    at pL (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:8255)
    at qr (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:8187)
    at http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:5043

The crash screen text is:

Something went wrong
An error occurred while loading the application.

Expected Behavior

If session data is missing or malformed, the app should handle it gracefully instead of crashing the entire UI during startup.

Frequency

  • Happened twice today

Notes

  • This looks related to session bootstrap/rendering because the top frame is in assets/session-*.js.
  • There is already #11702 about runtime crashes from unsafe assumptions, but this report is a user-facing UI crash on 1.2.20 with a concrete startup stack trace.
  • I have a screenshot of the error screen and can add it in a follow-up comment if that helps.

Activity

  1. cyberprophet commented on Mar 7, 2026

    @cyberprophet
    ContributorAuthor
    Image Image
  2. cyberprophet commented on Mar 7, 2026

    @cyberprophet
    ContributorAuthor
    TypeError: Cannot read properties of undefined (reading 'state')
        at c (http://127.0.0.1:4096/assets/session-CiCXkYTR.js:14:76803)
        at get metadata (http://127.0.0.1:4096/assets/session-CiCXkYTR.js:14:77783)
        at s (http://127.0.0.1:4096/assets/session-CiCXkYTR.js:14:83444)
        at Object.fn (http://127.0.0.1:4096/assets/session-CiCXkYTR.js:14:83669)
        at Mk (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:6835)
        at Pl (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:6592)
        at op (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:8002)
        at D6 (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:8883)
        at pL (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:8255)
        at qr (http://127.0.0.1:4096/assets/index-jLZvC0f3.js:2:8187)
    
  3. franBec commented on Mar 7, 2026

    @franBec

    just happened to me on the web UI, but if I quickly change to a different project as soon as it starts everything is fine. Maybe has something to do with what I was working before restarting the PC

    screenshot of working just fine on a random project I didnt even open yesterday
    Image

    what happens when going to my most recent project

    Image
    TypeError: Cannot read properties of undefined (reading 'length')
        at Object.fn (http://127.0.0.1:4096/assets/session-Cg8YeoLd.js:14:50663)
        at Mk (http://127.0.0.1:4096/assets/index-Dl3PGFdp.js:2:6835)
        at Pl (http://127.0.0.1:4096/assets/index-Dl3PGFdp.js:2:6592)
        at Object._6 (http://127.0.0.1:4096/assets/index-Dl3PGFdp.js:2:5606)
        at get style (http://127.0.0.1:4096/assets/session-Cg8YeoLd.js:14:51075)
        at jL (http://127.0.0.1:4096/assets/index-Dl3PGFdp.js:2:24146)
        at Object.fn (http://127.0.0.1:4096/assets/index-Dl3PGFdp.js:2:23793)
        at Mk (http://127.0.0.1:4096/assets/index-Dl3PGFdp.js:2:6835)
        at Pl (http://127.0.0.1:4096/assets/index-Dl3PGFdp.js:2:6592)
        at Oe (http://127.0.0.1:4096/assets/index-Dl3PGFdp.js:2:1831)
    

    my setup

              ▗▄▄▄       ▗▄▄▄▄    ▄▄▄▖             pollito@Lenovo-ideapad-L340-15IRH
              ▜███▙       ▜███▙  ▟███▛             ---------------------------------
               ▜███▙       ▜███▙▟███▛              OS: NixOS 25.11 (Xantusia) x86_64
                ▜███▙       ▜██████▛               Host: 81LK (IdeaPad L340-15IRH G)
         ▟█████████████████▙ ▜████▛     ▟▙         Kernel: Linux 6.12.62
        ▟███████████████████▙ ▜███▙    ▟██▙        Uptime: 4 mins
               ▄▄▄▄▖           ▜███▙  ▟███▛        Packages: 1998 (nix-system), 128)
              ▟███▛             ▜██▛ ▟███▛         Shell: zsh 5.9
             ▟███▛               ▜▛ ▟███▛          Display (BOE0700): 1920x1080 @ 1]
    ▟███████████▛                  ▟██████████▙    DE: Cinnamon 6.4.13
    ▜██████████▛                  ▟███████████▛    WM: Muffin (X11)
          ▟███▛ ▟▙               ▟███▛             WM Theme: Adapta-Nokto (Mint-Y)
         ▟███▛ ▟██▙             ▟███▛              Theme: Mint-Y-Dark-Aqua [GTK2/3/]
        ▟███▛  ▜███▙           ▝▀▀▀▀               Icons: Mint-Y-Aqua [GTK2/3/4]
        ▜██▛    ▜███▙ ▜██████████████████▛         Font: JetBrainsMono Nerd Font (1]
         ▜▛     ▟████▙ ▜████████████████▛          Cursor: Bibata-Modern-Classic (2)
               ▟██████▙       ▜███▙                Terminal: alacritty 0.16.1
              ▟███▛▜███▙       ▜███▙               Terminal Font: JetBrainsMono Ner)
             ▟███▛  ▜███▙       ▜███▙              CPU: Intel(R) Core(TM) i7-9750H z
             ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘              GPU 1: NVIDIA GeForce GTX 1650 M]
                                                   GPU 2: Intel UHD Graphics 630 @ ]
                                                   Memory: 1.52 GiB / 15.49 GiB (10)
                                                   Swap: 0 B / 24.78 GiB (0%)
                                                   Disk (/): 159.02 GiB / 450.62 Gi4
    
  4. jon23d commented on Mar 7, 2026

    @jon23d

    I have multiple different servers on different ubuntu VMs that are all doing this today. Switching the hostname that I use to access the application appears to fix it, until I open up the project.

  5. tobeycodes commented on Mar 7, 2026

    @tobeycodes

    This is happening for me but I have not updated opencode (currently on 1.2.15) so it is slightly odd opencode web is auto updating and running 1.2.20

  6. bxb1337 commented on Mar 7, 2026

    @bxb1337

    This is happening for me, on 1.2.19 and 1.2.20. Same error output

  7. yhdev7935 commented on Mar 7, 2026

    @yhdev7935

    guys have you used gpt 5.4 model? i got the same err

  8. jon23d commented on Mar 7, 2026

    @jon23d

    I uninstalled and reinstalled opencode, and it continues happening as soon as I begin a new session in the web ui. I wonder if there isn't some aggressive time-change stuff going on in there.

  9. bxb1337 commented on Mar 7, 2026

    @bxb1337

    guys have you used gpt 5.4 model? i got the same err

    I use.

  10. ajinkyaT commented on Mar 7, 2026

    @ajinkyaT

    Same issue here, updated to the latest version 1.2.25 still not resolving it.

  11. cyberprophet commented on Mar 7, 2026

    @cyberprophet
    ContributorAuthor

    Root Cause Analysis

    The crash originates in packages/app/src/components/session/session-header.tsx at line 306:

    const current = createMemo(() => options().find((o) => o.id === prefs.app) ?? options()[0])

    current() returns undefined when options() is temporarily empty — which happens during startup before the file-manager/app list resolves, or during project switching. Downstream accesses like current().id, current().label, and current().icon (lines 421, 423, 428, 458) then throw the TypeError.

    Fix

    Add a hardcoded fallback so current() is never undefined:

    const current = createMemo(
      () => options().find((o) => o.id === prefs.app) ?? options()[0] ?? { id: "finder", label: "Finder", icon: "finder" } as const
    )

    This is the same defensive pattern used in PR #16476 (props.text?.length ?? 0) and PR #16475 (createMemo(() => props.text ?? "")) which fix the structurally identical Cannot read properties of undefined (reading 'length') crash in TextShimmer (issue #16473).

    Related

    A PR fixing this is incoming.

  12. added a commit that references this issue on Mar 7, 2026
    99d5e6a
  13. tobeycodes commented on Mar 7, 2026

    @tobeycodes

    am i correct in understanding that when you run opencode web most requests for static assets are forwarded to app.opencode.ai and therefore we have no way to control which version of opencode desktop is running via the web command?

    https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/server/server.ts#L564-L579

  14. cyberprophet commented on Mar 7, 2026

    @cyberprophet
    ContributorAuthor

    @tobeycodes Yes, that's correct — with one important nuance.

    When you run opencode web, the server starts locally but the UI assets (HTML/JS/CSS) are proxied live from https://app.opencode.ai via the catch-all route in server.ts:564-579. So the frontend version you get is whatever is currently deployed to app.opencode.ai, not the version that matches your local opencode binary.

    This means:

    • You can't pin the UI version by staying on an older opencode binary — the frontend always comes from the live CDN
    • Fixes deployed to app.opencode.ai will reach you immediately without a binary update
    • The crash in this issue will be resolved once PR #16478 (or a similar fix) is merged and deployed to app.opencode.ai

    The Desktop app (Tauri) is different — it bundles the UI assets locally, so the version is pinned to the release you installed.

  15. tobeycodes commented on Mar 7, 2026

    @tobeycodes

    @tobeycodes Yes, that's correct — with one important nuance.

    where is the nuance? all you did was confirm what i said

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

webRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions