NotFoundError on startup: session JSON files not found in storage #8934

Open
opened 2026-02-16 18:11:12 -05:00 by yindo · 0 comments
Owner

Originally created by @riftzen-bit on GitHub (Feb 9, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

When launching opencode-desktop on Linux (Wayland/X11), the app throws NotFoundError for session JSON files that don't exist yet in the storage directory.

Environment

  • OS: Linux (Arch/CachyOS), Kernel 6.18.9
  • Desktop: Wayland (forced X11 via WEBKIT_DISABLE_DMABUF_RENDERER=1)
  • CLI version: 1.1.53
  • App version: 1.1.53

Steps to Reproduce

  1. Run WEBKIT_DISABLE_DMABUF_RENDERER=1 opencode-desktop
  2. App starts, sidecar spawns on a port, server becomes ready
  3. Two NotFoundError exceptions are thrown immediately

Error Output

opencode server listening on http://127.0.0.1:35895
Server ready after 662.897834ms

NotFoundError: NotFoundError
 data: {
  message: "Resource not found: /home/<user>/.local/share/opencode/storage/session/global/ses_3baf5522dffeiWPuSV70LW2NXb.json",
},
      at <anonymous> (src/storage/storage.ts:205:15)

NotFoundError: NotFoundError
 data: {
  message: "Resource not found: /home/<user>/.local/share/opencode/storage/session/global/ses_3baf4d5d4ffegHx1UI2qa9a5OS.json",
},
      at <anonymous> (src/storage/storage.ts:205:15)

Analysis

The error originates from src/storage/storage.ts:205 in the withErrorHandling wrapper. It catches ENOENT errors and re-throws as NotFoundError.

It appears the app tries to read session files (ses_*.json) that don't exist on disk. This could be:

  1. Stale session references pointing to deleted/missing files
  2. Missing graceful handling for first-run or cleaned storage scenarios
  3. Session index referencing IDs whose backing files were never created or were cleaned up

Expected Behavior

The app should handle missing session files gracefully — either by creating them, removing stale references, or silently skipping — instead of throwing unhandled NotFoundError exceptions to stderr.

Additional Context

The Wayland warning is unrelated:

"Wayland session detected; forcing X11 backend to avoid compositor protocol errors. Set OC_ALLOW_WAYLAND=1 to keep native Wayland."
Originally created by @riftzen-bit on GitHub (Feb 9, 2026). Originally assigned to: @rekram1-node on GitHub. ## Description When launching `opencode-desktop` on Linux (Wayland/X11), the app throws `NotFoundError` for session JSON files that don't exist yet in the storage directory. ## Environment - **OS:** Linux (Arch/CachyOS), Kernel 6.18.9 - **Desktop:** Wayland (forced X11 via `WEBKIT_DISABLE_DMABUF_RENDERER=1`) - **CLI version:** 1.1.53 - **App version:** 1.1.53 ## Steps to Reproduce 1. Run `WEBKIT_DISABLE_DMABUF_RENDERER=1 opencode-desktop` 2. App starts, sidecar spawns on a port, server becomes ready 3. Two `NotFoundError` exceptions are thrown immediately ## Error Output ``` opencode server listening on http://127.0.0.1:35895 Server ready after 662.897834ms NotFoundError: NotFoundError data: { message: "Resource not found: /home/<user>/.local/share/opencode/storage/session/global/ses_3baf5522dffeiWPuSV70LW2NXb.json", }, at <anonymous> (src/storage/storage.ts:205:15) NotFoundError: NotFoundError data: { message: "Resource not found: /home/<user>/.local/share/opencode/storage/session/global/ses_3baf4d5d4ffegHx1UI2qa9a5OS.json", }, at <anonymous> (src/storage/storage.ts:205:15) ``` ## Analysis The error originates from `src/storage/storage.ts:205` in the `withErrorHandling` wrapper. It catches `ENOENT` errors and re-throws as `NotFoundError`. It appears the app tries to read session files (`ses_*.json`) that don't exist on disk. This could be: 1. Stale session references pointing to deleted/missing files 2. Missing graceful handling for first-run or cleaned storage scenarios 3. Session index referencing IDs whose backing files were never created or were cleaned up ## Expected Behavior The app should handle missing session files gracefully — either by creating them, removing stale references, or silently skipping — instead of throwing unhandled `NotFoundError` exceptions to stderr. ## Additional Context The Wayland warning is unrelated: ``` "Wayland session detected; forcing X11 backend to avoid compositor protocol errors. Set OC_ALLOW_WAYLAND=1 to keep native Wayland." ```
yindo added the web label 2026-02-16 18:11:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8934