Skip to content

desktop: clicking a folder fails with fs/read 500 (Path is not a file) and UnexpectedStatus toast #50630

Closed

Description

@Mitty-Guang

Summary

In the desktop app, clicking a folder triggers a file read (GET /api/fs/read/<folder>), which fails with HTTP 500 Error: Path is not a file. The UI surfaces this as a toast 加载文件失败 / UnexpectedStatus. Directories should open as a listing, or at least return a clear, structured error instead of a 500.

Environment

  • opencode version: 2.0.13 (desktop app; bundled opencode-cli 2.0.13, background service healthy at http://127.0.0.1:49374)
  • OS: Windows 10.0.26200.9457 (win32 x64)
  • Terminal: Unavailable: not applicable (desktop app)
  • Shell: Unavailable: not applicable (desktop app)
  • Install/channel: latest (built-in updater reports "up-to-date" on 2.0.13)
  • Active plugins: none (only $schema in ~/.config/opencode/opencode.jsonc)

Reproduction

  1. Open the OpenCode desktop app and click a folder (e.g. a directory shown in the session or in the file panel). Tested with 面试模拟-2026-09-22 and Windows.
  2. The app sends GET /api/fs/read/<folder>.
  3. A toast appears: 加载文件失败 / UnexpectedStatus.

Expected Behavior

Clicking a directory should navigate to a directory listing (or show a clear "this is a folder" message). No 500 error toast.

Actual Behavior

Server returns 500 and logs:

timestamp=2026-09-22T12:54:37.156Z level=INFO cause="Error: Path is not a file\n    at <anonymous> (B:/~BUN/root/chunk-6qqn3fx3.js:117:12641)\n    at FileSystem.read (B:/~BUN/root/chunk-6qqn3fx3.js:432:16351)\n    at FileSystem.read (definition) (B:/~BUN/root/chunk-6qqn3fx3.js:117:12367)\n    at ServerProcess.start (B:/~BUN/root/chunk-27ptm178.js:2:6433)\n    at ServerProcess.start (definition) (B:/~BUN/root/chunk-6qqn3fx3.js:436:22432)" http.span=5 role=server http.method=GET http.url=/api/fs/read/%E9%9D%A2%E8%AF%95%E6%A8%A1%E6%8B%9F-2026-09-22 http.status=500
timestamp=2026-09-22T12:57:55.356Z level=INFO cause="Error: Path is not a file ..." role=server http.method=GET http.url=/api/fs/read/Windows http.status=500
timestamp=2026-09-22T12:58:09.832Z level=INFO cause="Error: Path is not a file ..." role=server http.method=GET http.url=/api/fs/read/Windows http.status=500

UI toast: 加载文件失败 / UnexpectedStatus.

Additional Context

  • Reproduced consistently; both non-ASCII and pure-ASCII folder names fail, so it is not a path-encoding issue.
  • Clicking actual files works normally.
  • Likely cause: directory clicks are routed to the same code path as files (fs/read), and the Path is not a file error is mapped to HTTP 500 that the client reports as UnexpectedStatus.
  • Log file: ~/.local/share/opencode/log/opencode.log
  • Workaround: open folders through the OS file manager instead (see the related issue about the "open in file manager" action).

Activity

  1. Mitty-Guang commented on Sep 22, 2026

    @Mitty-Guang
    Author

    Update: verified on desktop 2.0.14 (Windows 11, 10.0.26200.9457) — the folder issue still reproduces.

    Steps: update to 2.0.14, click a directory (e.g. C:\Windows) → toast 加载文件失败 / UnexpectedStatus. Server log entry right after the update:

    timestamp=2026-09-22T13:40:34.971Z level=INFO cause="Error: Path is not a file ... at FileSystem.read ..." http.span=223 role=server http.method=GET http.url=/api/fs/read/Windows http.status=500
    

    Note: the separate "open in file manager" bug (#47722 / #50632) is fixed for me on 2.0.14 — this folder-read issue is still open.

  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report and logs. I reproduced the server side of this on 2.0.13: in a project with a folder Windows, GET /api/fs/read/Windows returns HTTP 500, while reading a regular file works.

    On the latest dev (fa1260d) the same request returns a clear 404 FileNotFoundError instead of the 500. The change is #53088. Separately, #53641 changed how file links in the session timeline are resolved: the app now checks whether a link points to a file without reading it first. So this is likely already fixed, and the fix should be in a future release. I could only test the server API here, not the desktop app itself.

    2.0.13 is a few releases behind the current version, so please update the desktop app when a newer release reaches you. The bot will close this issue in 1 day unless you reply that it still happens on a newer version, e.g. you still get the UnexpectedStatus toast when clicking a folder.

  3. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Closing this as completed, since there hasn't been a reply in the past day. On 2.0.13, GET /api/fs/read/<folder> returns the HTTP 500 you reported. On the latest dev (fa1260d) the same request returns a clear 404 FileNotFoundError instead (changed in #53088), and #53641 changed how file links in the timeline are resolved. So this is most likely fixed, and the fix should be in an upcoming release.

    I could only test the server here, not the desktop app. If you still get the UnexpectedStatus toast when clicking a folder after updating to a newer version, please comment here or open a new issue with the version and steps. Thanks again for the detailed report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions