Repository navigation
Closed as duplicate
Closed as duplicate
Copy link
Labels
Description
Summary
OpenCode creates multiple project rows for the same canonical directory, and archiving one does not stick. One row is keyed by the repo's first-commit hash; evicting/re-resolving the location creates a second row with a random ID. There is no API/CLI/UI to archive or delete a project, and when a row is archived directly in the database, re-resolving the location (e.g. after a restart) reactivates it.
Environment
- opencode version: 2.2.0
- OS: Windows_NT 10.0.26300 (win32 x64)
- Terminal: xterm-256color (OpenCode desktop app)
- Shell:
pwshconfigured; ComSpecC:\Windows\system32\cmd.exe - Install/channel: desktop app, latest
- Active plugins: none
Reproduction
- Have several git repositories under a directory tree and open each once so it registers a project (
GET /api/locationor by using it in the app). - Evict and re-resolve a location:
DELETE /api/debug/location?location[directory]=<dir>GET /api/location?location[directory]=<dir>
GET /api/projectnow returns two entries with the samecanonicalbut differentid.- Archive the extra row — there is no API for it, so set
time_archivedin theprojecttable — then restart OpenCode / re-resolve the location.
Expected Behavior
- Exactly one project per canonical directory.
- Re-resolving a location reuses the existing project instead of creating a new row.
- Archiving/deleting a project is supported and persists.
Actual Behavior
- Duplicate project rows per canonical directory. In one session, evicting + re-resolving each of 8 locations created 8 extra rows; a later reboot revived one archived row when its location was restored.
- Archiving is undone by re-resolution: after the reboot, the archived duplicate for the location that was restored became active again, while archived rows for locations that were never touched stayed archived.
- No supported way to remove or archive a project:
GET /api/projectsupports listing (with anarchivedfilter), andPATCH /api/project/{projectID}accepts onlycanonical,name,icon,commands— no delete/archive.- The desktop app's project client exposes the same two operations.
- The CLI has no
projectsubcommand.
Additional Context
project table rows for a single directory (illustrative). The first id equals that repo's initial commit hash; the second is random:
id=ec38b3013dbcc4980ad0bc27905420e65743bfec worktree=C:/lab/projects/home-assistant vcs=git name="Home Assistant Configuration"
id=bab03753f2112a6b2bd6f6a5673cdfc2f85232b8 worktree=C:/lab/projects/home-assistant vcs=git name=null
- Frequency: reproducible — a loop of evict + re-resolve over 8 directories produced 8 new rows; the reboot recurrence happened once when a previously-archived location was restored.
- Workaround: edit the SQLite
projecttable directly (time_archived) to hide the extra rows. This is the only way found; it can be reverted by re-resolution.
Raw active/duplicate counts observed (via the local opencode.db)
total active: 17 total archived: 12
C:/lab/projects/home-assistant -> 2 active rows (true duplicate)
Activity
opencodejr commentedon Nov 1, 2026
Thanks for the detailed report! I think this is a duplicate of #57985.
The two IDs come from how OpenCode picks a git project's ID: a hash of the
originremote URL is used first, ahead of the stored ID and the root commit. A repo first registered under its root-commit ID (yourec38b30…row) gets a second, remote-derived row (bab0375…) the next time its location is resolved from scratch, for example after an eviction. That is the mechanism described in #57985.On the other two points:
time_archivedby hand in the database isn't supported, so it gets undone.DELETE /api/project/:projectID.Possible duplicates and related issues, ordered by likelihood:
projectrow for the same worktreeprojectrows #59371: a worktree with duplicateprojectrows hides sessions in the folder-scoped list (PR fix(core): list sessions across every project row of the same worktree #59946)The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. For example, if you see duplicates in a repo with no
originremote, that would be different.opencodejr commentedon Nov 2, 2026
There hasn't been a reply in the past day, so I'm closing this as a duplicate of #57985. The duplicate
projectrows come from the git project ID switching from the root-commit ID to a remote-derived ID. Please follow #57985 for that, and #51197 / PR #59580 for archiving and deleting projects through the API.If your case is different, for example duplicates in a repo with no
originremote, please reply here with the details and we can reopen it. Thanks again for the thorough report!