You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: Sessions not showing in opencode desktop UI due to inconsistent path separator (/ vs \) #31597
On Windows, sessions created at different times store the directory field in the SQLite DB with inconsistent path separators — some use forward slashes (D:/Workspace/my-project), others use backslashes (D:\Workspace\my-project). The project.worktree field uses backslashes (D:\Workspace\my-project).
When opencode loads sessions for the current project, it appears to match session.directory against the current working directory (or project.worktree) using exact string comparison. Because of the slash mismatch, sessions stored with / are not displayed in the opencode desktop UI session list.
opencode does not normalize path separators when persisting session.directory. On Windows, path.resolve() or equivalent can return either / or \ depending on the calling context (e.g. Git integration may return /, Node.js process.cwd() returns ).
Suggested Fix
Normalize all file paths to use the OS-native separator (or consistently use /) before writing to the database. For example, call path.normalize() or replace / with \ on Windows before any DB write.
Workaround
Manually update the SQLite database:
sqlite3 ~/.local/share/opencode/opencode.db
"UPDATE session SET directory = REPLACE(directory, '/', '') WHERE directory LIKE '%:/%';"
Plugins
No response
OpenCode version
v1.14.22
Steps to reproduce
-- project table
SELECT worktree FROM project WHERE id='abc123...';
-- Result: D:\Workspace\my-project
-- session table (before fix)
SELECT directory, COUNT(*) FROM session WHERE project_id='abc123...' GROUP BY directory;
-- Result:
-- D:/Workspace/my-project | 17
-- D:\Workspace\my-project | 1
17 sessions were invisible in the TUI because their directory used / while the project used .
Fixed in v1.16.0 by #29666 — you reported this on v1.14.22, which predates the fix.
Since v1.16.0 the canonical storage form is forward slashes: session/project path columns are Drizzle custom types (packages/core/src/database/path.ts) that normalize writes and query parameters, and the one-time migration 20260601010001_normalize_storage_paths rewrites existing backslash rows on upgrade, so your mixed D:/... / D:\... rows converge automatically.
One important note: the manual workaround in this issue goes in the opposite direction of the storage invariant (REPLACE(directory, '/', '\')). If you applied it after upgrading to >= v1.16.0, the migration will not re-run and those rows will stop matching — reverse it with:
UPDATE session SET directory = REPLACE(directory, char(92), '/') WHERE directory GLOB '[A-Za-z]:'||char(92) ||'*';
Please upgrade and remove the workaround. If sessions are still missing on a current release, comment with opencode --version and a sample directory value and we will reopen.
Activity
github-actions commentedon Jun 10, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct, please clarify how it differs from the above.
Hona commentedon Jul 2, 2026
Fixed in v1.16.0 by #29666 — you reported this on v1.14.22, which predates the fix.
Since v1.16.0 the canonical storage form is forward slashes: session/project path columns are Drizzle custom types (
packages/core/src/database/path.ts) that normalize writes and query parameters, and the one-time migration20260601010001_normalize_storage_pathsrewrites existing backslash rows on upgrade, so your mixedD:/.../D:\...rows converge automatically.One important note: the manual workaround in this issue goes in the opposite direction of the storage invariant (
REPLACE(directory, '/', '\')). If you applied it after upgrading to >= v1.16.0, the migration will not re-run and those rows will stop matching — reverse it with:Please upgrade and remove the workaround. If sessions are still missing on a current release, comment with
opencode --versionand a sampledirectoryvalue and we will reopen.