Repository navigation
Closed as not planned
Closed as not planned
Copy link
Description
Description
Bug Report — Sessions & projects point to a stale absolute path after the project folder is moved/renamed
Reported by: Rahmad Arif — linkedin.com/in/rahmadar-if
Title
When a project folder is moved or renamed, existing sessions (and the project record) keep the old absolute directory/path/worktree. The old path no longer exists on disk, so "Reveal in Explorer" / reveal folder fails, and there is no UI/config setting to rebase a session to the current project location.
Environment
- Platform: Windows (win32), PowerShell 5.1
- App: opencode Desktop
OpenCode.exe, version 1.18.31 (core data version 1.18.30) - Storage: SQLite database
%USERPROFILE%\.local\share\opencode\opencode.db
Steps to reproduce
- Have a Git repo project at
D:\_RAHMAD\_2026\Al Wildan\portal_wali_murid. - Move the whole folder (repo included) to a new location, e.g.
D:\_RAHMAD\_2026\_Portal Wali Murid\portal_wali_murid; delete the old path. - Open the project from its new location and continue old sessions from the session list (e.g. a session titled
Tambah murid & dummy data Kelas 1 Inter 2). - The old sessions still resolve to the stale path:
- Prompt / working directory shows
PS D:\_RAHMAD\_2026\Al Wildan\portal_wali_murid>. - "Reveal folder" tries to open the old (non-existent) directory and fails.
- Prompt / working directory shows
- There is no way via UI, config, or command to point those sessions to the new path.
What happens in the database (root cause)
opencode stores the working directory in several places inside opencode.db (event-sourced):
- Table
session→ columnsproject_id,directory,path:id=ses_f526c9830ffe... title="Tambah murid & dummy data Kelas 1 Inter 2" project_id="global" directory="D:/_RAHMAD/_2026/Al Wildan/portal_wali_murid" path="D:/_RAHMAD/_2026/Al Wildan/portal_wali_murid" - Table
event→session.created.1/session.updated.1JSON payloadinfo:{"info":{"projectID":"global","directory":"D:\\_RAHMAD\\_2026\\Al Wildan\\portal_wali_murid","path":"D:/_RAHMAD/_2026/Al Wildan/portal_wali_murid", ...}} - Table
projectkeeps a staleworktreeeven after the repo moved, and the project is auto-renamed to"<name> OLD":-- project id worktree name -- bccf36a3... D:/_RAHMAD/_2026/Al Wildan/portal_wali_murid portal_wali_murid OLD -- while table project_directory already points to the NEW path: -- bccf36a3... D:/_RAHMAD/_2026/_Portal Wali Murid/portal_wali_murid
- No "path setting" exists anywhere in the project files or opencode config — the path lives only inside the database, so users cannot fix it without editing SQLite directly.
Expected behavior
- After the worktree location changes, sessions kept under the old path should either be rebased automatically (e.g. detect that
session.directoryno longer exists on disk and the session belongs to a project whoseproject_directorywas resolved elsewhere, then ask "Move N sessions to ?") or be offered an explicit action "Move to current folder". project.worktreeshould be updated whenproject_directoryresolves to a new path (treat it as authoritative), instead of getting a misleading"<name> OLD"label.- "Reveal in Explorer" should never navigate to a directory that no longer exists.
Suggested fix
- On session open / project resolve: if
session.directorydoes not exist on disk, fall back to the resolvedproject_directoryand prompt to rebase the session (updatesession.project_id/directory/pathand the event-sourcedsession.created.1/session.updated.1payloads). - When the repo root differs from
project.worktree, updateproject.worktree(and drop theOLDsuffix). - Optionally expose a command such as
/project:move <old-path>or a settings entry to manually rebase a stored path.
Workaround used
With opencode closed, edit opencode.db in a single transaction:
UPDATE session SET project_id=:new_pid, directory=:new_dir, path='' WHERE directory LIKE 'D:/_RAHMAD/_2026/Al Wildan/%';- Rewrite the same fields inside the JSON
dataofeventrows of typesession.created.1/session.updated.1. UPDATE project SET worktree=:new_dir, name=:name WHERE id=:pid;
Then restart opencode.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Metadata
Metadata
Assignees
Labels
No labels
Activity
github-actions commentedon Sep 17, 2026
This issue might be a duplicate of existing issues. Please check:
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊