Repository navigation
Description
Summary
On Windows, OpenCode 2.3.2 cannot create a Location for any folder on a DriveCrypt (SecurStar) encrypted drive. realpathSync.native returns ENOENT for those paths, the boot probe in packages/core/src/filesystem.ts turns that into DirectoryNotFoundError, and every API call for that folder answers 404 LocationNotFoundError. The TUI then shows "Session location unavailable", and opencode session list prints Location not found: <dir>. Plain file I/O (open, stat, opendir) and the JS fs.realpathSync work fine on the same paths.
Environment
- opencode version: 2.3.2
- OS: Windows 10.0.19045 (win32 x64)
- Terminal: Windows Terminal
- Shell: PowerShell 7.6.10 (launching
opencode);%COMSPEC%:C:\windows\system32\cmd.exe - Install/channel: npm global
@opencode/[email protected], channellatest, not standalone - Active plugins: none
Reproduction
- Install DriveCrypt 6.1.4 and mount an encrypted container as drive
H:. The drive reports as a fixed NTFS volume and is fully read/write. - Create a folder on it, e.g.
H:\work\my-project. - From that folder run
opencode session list(or startopencode). - Observe
Location not found: H:\work\my-project(exit 1). In the TUI, opening any session whose directory is on that drive shows "Session location unavailable", and "Choose directory" only offers a worktree list that is empty. - As a control, run the same command from a folder on
C:. A Location is created and sessions are listed.
The same happens with a private server: opencode --standalone --print-logs --log-level trace session list in the affected folder starts the server, subscribes watchers for the folder, and then GET /api/location returns 404.
Expected Behavior
A Location is created for the folder, exactly as it is for a folder on C:, and the session in that folder can be opened.
Actual Behavior
GET /api/location returns 404, the CLI prints Location not found: H:\work\my-project, the TUI shows "Session location unavailable", and every existing session whose directory is on that drive becomes unreachable.
Measurements on the affected machine (Node v24.15.0 and Bun 1.4.4, i.e. the runtime inside opencode.exe, behave identically):
| path | realpathSync.native |
realpathSync (JS) |
open/stat/opendir |
|---|---|---|---|
H:\ |
ENOENT |
OK | OK |
H:\work\my-project |
ENOENT |
OK | OK |
G:\ (second DriveCrypt container) |
ENOENT |
OK | OK |
C:\ and folders on it |
OK | OK | OK |
C:\Users\<user>\.config\<dir> (a symlink pointing into H:) |
ENOENT |
OK | OK |
\\?\H:\... and \\.\H:\... fail the same way.
Volume facts for the affected drives: Win32_LogicalDisk reports DriveType 3, NTFS, with size and free space, but mountvol H: /L answers "The parameter is incorrect", Get-Volume -DriveLetter H finds no MSFT_Volume, and fsutil volume diskfree H: prints "A local NTFS volume is required for this operation" before it reports sizes. The DriveCrypt FileCrypt driver is loaded and DriveCryptService is running. In other words, the drive is a virtual device with a drive-letter alias but no volume mount point, so GetFinalPathNameByHandleW(FILE_NAME_NORMALIZED | VOLUME_NAME_DOS) cannot produce a final path for it.
Additional Context
Where it fails on the current dev sources:
packages/core/src/filesystem.ts,FileSystem.nodeboot probe:yield* fs.realPath(location.directory)withEffect.catchmappingNotFoundtoDirectoryNotFoundError. There is no fallback, so a Location on such a drive can never be constructed.packages/server/src/location.tsmapsFileSystem.DirectoryNotFoundErrortoLocationNotFoundError, which is what every endpoint for that directory returns.FSUtil.resolveinpackages/util/src/fs-util.tsalready has the tolerant behaviour (Effect.catchIf(NotFound | access denied, () => resolved)), andProject.resolvegoes through that path. Only the boot probe is strict, which is why the symptom presents as "the folder does not exist" even though it is readable and writable.
Suggested fix: let the boot probe tolerate a native realpath failure the way FSUtil.resolve does, for example by falling back to the configured directory when fs.stat(directory) (or the JS realpathSync) succeeds after the native call reports NotFound, and by failing only when the directory is genuinely missing. A JS realpath fallback would also cover other virtual or filter-driver volumes where the native call is unavailable, such as the WinFsp case in #60449.
Related: #60449 (realpath EUNKNOWN on WinFsp virtual drives breaks most API endpoints with 500), #61085 (no typed-directory recovery in the "Session location unavailable" panel; this report hits that dead end too).
Workaround for users: start OpenCode from a folder on a real volume. Files on the affected drive stay readable and editable from such a session, because only Location construction fails.
Activity
opencodejr commentedon Nov 19, 2026
Thanks for the detailed measurements and the code walkthrough. I couldn't reproduce this here: it needs Windows with a DriveCrypt (or similar) virtual drive, where the native realpath call fails even though the folder itself is readable. This sandbox runs only Linux, and there a readable folder always resolves.
A maintainer with a Windows machine and such a drive will need to confirm it. Until then, starting OpenCode from a folder on a regular volume is the workaround you describe.
Closely related: #60449, where a WinFsp drive returns
EUNKNOWNfrom realpath through a different code path and gets HTTP 500 instead of 404. A fix there may well cover this case too.davide-vecchi commentedon Nov 19, 2026
Added by the human : it was working fine with OpenCode V1.
Guembri01 commentedon Nov 27, 2026
Fixed on branch
filesystem-realpath-enoent(a248906).You had the exact line: the boot probe used native realpath and turned its
ENOENTintoDirectoryNotFoundError. OnlyNotFoundnow falls back to the lexical path, and the access probe that already follows decides whether the directory exists:That keeps the neighbouring behaviour intact:
DirectoryNotFoundErrorDirectoryAccessDeniedErrorPermissionDenied,Unknownand other realpath failures keep their classification (I first tried the existingfs.resolvehelper and it swallowed access denials — theEACCES/EPERM/EIOclassification tests caught it)New test reuses the layer-replacement harness in
location-filesystem.test.ts: a real temp directory whoserealPathis overridden to fail withNotFoundfor the root — what the driver does. Boot fails withfilesystem.tsreverted and succeeds with the change.location-filesystem,filesystemand the new file are 37 pass; the only failure iscanonicalizes local symlinked directories, which fails the same way ondevhere because this shell cannot create symlinks. Typecheck and oxlint are clean.PR creation is 404 for this account again, so it waits as a branch with the body written.