[BUG][Desktop] Opening file path instead of directory creates corrupt project entries #9351

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

Originally created by @sms-swe on GitHub (Feb 14, 2026).

Originally assigned to: @adamdotdevin on GitHub.

Description

Opening the app with a file path instead of a directory causes server.projects.open() to receive undefined, creating corrupt project entries in localStorage that crash the app on subsequent loads.

Plugins

No response

OpenCode version

latest dev

Steps to reproduce

  1. Open the app with a file path instead of a directory
  2. During SolidJS reactive system initialization, server.projects.open(undefined) gets called
  3. A corrupt entry {expanded: true} (no worktree) is saved to localStorage at opencode.global.dat
  4. On next app load, the app crashes with:
    • TypeError: undefined is not an object (evaluating 'projects.map')
    • TypeError: undefined is not an object (evaluating 'dir.slice')

Screenshot and/or share link

No response

Operating System

macOS 26.2

Terminal

Ghostty

Originally created by @sms-swe on GitHub (Feb 14, 2026). Originally assigned to: @adamdotdevin on GitHub. ### Description Opening the app with a file path instead of a directory causes `server.projects.open()` to receive `undefined`, creating corrupt project entries in localStorage that crash the app on subsequent loads. ### Plugins _No response_ ### OpenCode version latest dev ### Steps to reproduce 1. Open the app with a file path instead of a directory 2. During SolidJS reactive system initialization, `server.projects.open(undefined)` gets called 3. A corrupt entry `{expanded: true}` (no worktree) is saved to localStorage at `opencode.global.dat` 4. On next app load, the app crashes with: - `TypeError: undefined is not an object (evaluating 'projects.map')` - `TypeError: undefined is not an object (evaluating 'dir.slice')` ### Screenshot and/or share link _No response_ ### Operating System macOS 26.2 ### Terminal Ghostty
yindo added the bugweb labels 2026-02-16 18:12:15 -05:00
Author
Owner

@alexyaroshuk commented on GitHub (Feb 14, 2026):

I wanted to reproduce this, but not sure i understand ( i am on windows). I cannot open file as projects in the app, as i can only select projects

@alexyaroshuk commented on GitHub (Feb 14, 2026): I wanted to reproduce this, but not sure i understand ( i am on windows). I cannot open file as projects in the app, as i can only select projects
Author
Owner

@sms-swe commented on GitHub (Feb 14, 2026):

On mac I was able to do something like 'open /Applications/OpenCode.app /path/to/your/project/index.ts'

I stumbled onto this whole flow when I started looking into #13534

@sms-swe commented on GitHub (Feb 14, 2026): On mac I was able to do something like 'open /Applications/OpenCode.app /path/to/your/project/index.ts' I stumbled onto this whole flow when I started looking into #13534
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9351