Skip to content

Desktop app: file browser uses stale absolute paths after moving project directory #37697

Description

@mikhail73

Description
When a project directory is moved to a new location, the desktop app's file browser continues to resolve paths against the old (non-existent) location, causing ENOENT errors.

The old absolute path (UUID-based mount point /media//misha/web/...) is stored as a hardcoded string in:

~/.local/share/opencode/opencode.db (SQLite) — in session.directory, project.worktree, message.data, part.data, event.data tables
~/.config/ai.opencode.desktop/opencode.global.dat — layout/workspace metadata
~/.config/ai.opencode.desktop/opencode.window.*.dat
Steps to Reproduce
Open a project from an external drive path (e.g. /media//user/project)
Move the project to a new location (e.g. /home/user/project)
Open opencode desktop pointing to the new location
File browser fails with: ENOENT: no such file or directory, lstat '/media//user'
Expected Behavior
Either:

The app should detect the directory has moved and update stored paths automatically
Provide a UI option to relocate/update project paths
Or at minimum, fall back gracefully instead of crashing on startup
Workaround
Manually replace old paths in the SQLite database and JSON .dat files:

sqlite3 ~/.local/share/opencode/opencode.db "UPDATE session SET directory = replace(directory, '', ''); UPDATE project SET worktree = replace(worktree, '', '');"
And replace strings in ~/.config/ai.opencode.desktop/opencode.global.dat and opencode.window.*.dat.

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