Repository navigation
Description
Description
The desktop app becomes unusable if its current project directory is moved or deleted. Every directory-scoped API endpoint returns HTTP 500, and the renderer dies during startup with "Échec de la requête au serveur — Le serveur a renvoyé une réponse HTTP 500".
The bundled service itself is healthy (GET /api/info → 200). Server log, role=server:
cause="PlatformError: NotFound: FileSystem.realPath (<old path>)
[cause]: Error: ENOENT: no such file or directory, lstat '<old path>'"
http.method=GET http.url=/api/skill http.status=500
Endpoints returning 500: /api/skill, /api/mcp, /api/plugin, /api/provider, /api/model, /api/integration, /api/location. The same call with x-opencode-directory pointing at an existing directory returns 200, so the failure is purely path resolution:
GET /api/skill x-opencode-directory: <old path> -> 500
GET /api/skill x-opencode-directory: <existing path> -> 200
The error screen offers only Restart, which re-reads the same stale directory and fails identically, so there is no way out from the UI.
Plugins
None declared in ~/.config/opencode/opencode.jsonc.
OpenCode version
2.0.18 (desktop app, with its bundled opencode-cli serve --service)
Steps to reproduce
- In the desktop app, open a folder as a project, e.g.
$HOME/Documents/Default Project, and use it (one session is enough). - Quit the app.
mv "$HOME/Documents/Default Project" "$HOME/Documents/OpenCode/Default Project"- Launch the app again.
Screenshot and/or share link
Full-window error screen: an "OpenCode" wordmark, the heading "Échec de la requête au serveur", the subtext "Le serveur a renvoyé une réponse HTTP 500", a collapsed stack trace (ClientError: UnexpectedStatus: 500), then the buttons "Redémarrer", "Exporter les journaux" and "Signaler l'erreur".
Operating System
macOS 26 (Darwin 25.6.0, arm64)
Terminal
Not applicable — desktop app (Electron). Shell: /bin/zsh.
Additional context
Same root cause as #50548 (FileSystem service resolving the location directory with realPath(...).pipe(Effect.orDie)) — still present in 2.0.18. Same startup symptom as #30750 (closed, 1.15.11) and same stale-worktree behaviour as #35240 (closed, where clearing client state did not help because the client re-learns the dead path from the server).
Two places persist the dead path and nothing in the product exposes them:
- Client state,
~/Library/Application Support/ai.opencode.desktop/drafts.sqlite, tablestate, documentopencode.global.dat:layout.home.selection.directoryis what makes startup fatal;server.projects.local[].worktreekeeps the dead project in the sidebar. - Server database,
~/.local/share/opencode/opencode.db:project.worktree(andsession.directory/session_v2.directoryfor existing sessions in that project).
Correcting both files while the service is running is not sufficient: GET /api/project still returned the removed project and the server re-inserted the row that had just been deleted, and POST /api/location/reload did not clear it. PATCH /api/project/{projectID} with the new canonical did fix it without a service restart. A full recovery needs the two files edited and the service restarted.
Expected instead: treat a missing project directory as a normal condition and fall back to a valid location, or at least name the missing path in a recoverable message.
Secondary: ~/.local/share/opencode/log/opencode.log has no rotation or size bound — 47 MB in about two days.
Logs above are redacted of prompts, file contents, credentials and absolute paths containing a username.
Activity
github-actions commentedon Sep 26, 2026
Thanks for updating the issue with a clear description, reproduction steps, and system information!
alecgib77 commentedon Sep 26, 2026
Consolidated into #50548, which is open, already identifies the root cause (
fs.realPath(...).pipe(Effect.orDie)inpackages/core/src/filesystem.ts) and proposes a fix.I've moved the details that were not already there into that thread: #50548 (comment)
Closing this as a duplicate so the same defect isn't split across two reports. The full analysis also lives in the thread above, including why the
fs.resolvefix alone won't stop the client from reopening the dead path.Chudesnov commentedon Nov 7, 2026
Related data point:
POST /api/location/reload— the documented recovery path — returns 503 (FileSystem.DirectoryNotFoundError) when any loaded location's directory has been moved or deleted, aborting the rebuild while a phantom path is loaded. The still-valid locations were disposed before the error surfaced, but the endpoint can't complete. Desktop 2.2.6 service, Windows 11.