Skip to content

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

Closed

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.

Activity

  1. github-actions commented on Jul 19, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is the same as one of these, please add a comment there with any additional details rather than opening a new one.

  2. NuWhE3wn0D commented on Jul 19, 2026

    @NuWhE3wn0D

    It seems the app lacks a mechanism to detect when a project has moved, which leads to the hardcoded paths in opencode.db causing the ENOENT errors. One potential improvement could be implementing a function that checks the existence of the directory at startup and prompts the user to update paths if the project is no longer found. Also, can you confirm if there are any existing hooks or events that trigger on project open that could be leveraged to automate the path update instead of requiring manual database edits?

  3. Hona commented on Sep 2, 2026

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions