Repository navigation
Description
Description
OpenCode Desktop 1.18.30 redirects a moved Git project back to its old, nonexistent directory, even when I explicitly select the new directory in “Open project.”
Related: #47803 and #46330. I saw that #46330 was closed via #46713 for the OpenCode 2 launch. This report confirms the behavior on the 1.18.30 desktop release; I have not tested the OpenCode 2 beta. The PR description also explicitly leaves existing session history unchanged.
Steps to reproduce
- Open a Git project at
/Users/example/dev/old/repoin Desktop and create a session. - Move the project, including
.git, to/Users/example/dev/new/repo. The old directory no longer exists. - In Desktop, choose Open project and explicitly select the new directory.
- Desktop resolves the project back to the old location instead of consistently opening the selected directory.
Expected: Open the selected directory. If existing sessions still reference a missing location, provide a supported way to reassociate them while preserving history.
Actual: The old canonical path is retained and reused. The backend can initialize the new directory, but logs also contain FileSystem.realPath / ENOENT failures for previously registered locations.
Diagnostic evidence
Paths and project identifiers below are anonymized. Inspection before the local repair showed:
| Record | Stored value |
|---|---|
project.id |
Same project ID before/after the move, also cached in .git/opencode |
project.worktree |
/Users/example/dev/old/repo (missing) |
project.sandboxes |
["/Users/example/dev/new/repo"] |
project_directory.directory |
/Users/example/dev/new/repo |
session.directory |
8 existing sessions still bound to the old directory |
Desktop's opencode.global.dat also retained old locations in server, layout and layout.page, including encoded session-route keys.
In Project.fromDirectory at v1.18.30, an existing non-global project's canonical path is retained:
worktree: projectID === ProjectV2.ID.global ? worktree : existing.worktree,The newly resolved directory is then added to sandboxes; the existence filtering below applies to sandboxes, not the retained worktree. This matches the database state above.
Local recovery required backing up the database/UI state and correcting the project path, affected session directories and desktop navigation references. Database integrity and preservation of all 8 session records were verified; final UI verification after restarting was still pending when preparing this report. A supported relocation/recovery flow would avoid manual SQLite and desktop-state edits.
Plugins
oh-my-openagent@latest is configured. The log also contains a separate plugin-loading error involving the bun: protocol. I have not reproduced this in plugin-free mode; the project-path persistence behavior above was verified independently in the database and shipped source.
OpenCode version
Desktop 1.18.30 (Electron). Separately installed CLI: 1.17.9; the reported workflow uses Desktop.
Operating System
macOS 26.5.2, build 25F84, Apple Silicon (arm64).
Terminal
Not applicable: Desktop's project picker.
Activity
bebauke commentedon Sep 10, 2026
Confirmed on Windows / OpenCode Desktop 1.18.30 with the same failure mode after moving and renaming a Git project while preserving
.git.Before repair, the SQLite state was:
project.id: unchanged and reused for the moved repositoryproject.worktree: old deleted directoryproject.sandboxes: contained the new directoryproject_directory.directory: contained the new directorysession.directoryvalues: old deleted directorySelecting the new project successfully initialized and watched the new path, but opening existing chats also created an instance for the deleted path and immediately logged
PlatformError: NotFound: FileSystem.realPath (...), caused byENOENT. From the UI, chats appeared to end abruptly.A local workaround was to back up
~/.local/share/opencode/opencode.db, update the matchingproject.worktree,session.directory, and matching non-emptysession.pathvalues to the new directory, then restart Desktop.PRAGMA integrity_checkreturnedok, all three sessions were preserved, and no active project/session route still referenced the deleted location.This confirms the issue is not macOS-specific and that updating only
sandboxes/project_directoryis insufficient for existing sessions.roalvesrj commentedon Oct 7, 2026
I can confirm the same problem here, even using the latest updates!
neriousy commentedon Oct 20, 2026
Thanks for the detailed diagnosis of the moved repository and its existing sessions. v2 updates a missing canonical project path when you open the moved repository, and sessions with unavailable directories offer a directory picker to reassociate them without manual database edits. v1 now receives only critical fixes; please update the desktop app, or install the v2 CLI with
npm i -g @opencode/cli@latest. If opening the moved project or reassociating its sessions still fails on v2, please open a new issue with those details.