Sshfs write to exist dir issue

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Symptom
When trying to create or update a file inside a UNC/sshfs path like \sshfs\user@host..., the write operation sometimes fails with:
EPERM: operation not permitted, mkdir ‘\sshfs...\SGX_project\EthSignerEnclave\e2e_mvp_hybrid’
At the same time:
Reading files from \sshfs... works consistently.
Writing to \sshfs... is possible in general (e.g., creating a new file in a new subfolder inside e2e_mvp_hybrid/ succeeds).
The error looks like Cursor is trying to mkdir an existing parent directory and failing with EPERM.
Minimal repro (high-level)

  1. Open a workspace located on \sshfs\user@host\path\to\repo (sshfs mounted on Windows as a UNC share).
  2. Try to write/patch an existing file in an existing folder, e.g.:
    update \sshfs...\e2e_mvp_hybrid\e2e_runbook_regtest.sh
    or add \sshfs...\e2e_mvp_hybrid\newfile.txt
  3. Observe failure: EPERM … mkdir ‘\sshfs...\e2e_mvp_hybrid’.
  4. In contrast, adding a file under a new nested directory succeeds, e.g.:
    add \sshfs...\e2e_mvp_hybrid_tmp_random\test.txt
    Internal diagnosis (based on observed behavior)
    There appears to be an “ensure parent directory exists” step in the write pipeline that:
    incorrectly decides the parent directory is missing, or
    incorrectly normalizes/resolves the UNC path and calls mkdir incorrectly, or
    calls mkdir on \sshfs...\e2e_mvp_hybrid even when updating an existing file,
    and on sshfs/UNC this mkdir returns EPERM (instead of behaving as a no-op / “already exists”).
    Key signal: creating a new subfolder + file works, so the share is writable; the failure is strongly correlated with an erroneous mkdir on an already-existing directory (or on a wrongly resolved parent path).
    Expected behavior
    Updating an existing file should not attempt to create its parent directory.
    Creating a new file should only mkdir -p directories that truly do not exist, and should correctly handle “already exists” on UNC/sshfs.
    Actual behavior
    Cursor intermittently attempts mkdir on an existing directory (or the wrong parent) and fails with EPERM.
    Workaround
    Use a staging directory: write changes into a new subfolder (e.g. _cursor_patched/…), then manually move the file into place on the Linux side (mv). This is disruptive to normal development flow.
    Environment
    Windows UI
    Project located on Linux via sshfs, exposed to Windows as \sshfs... UNC path

Steps to Reproduce

  1. Open the workspace at \sshfs\user@host\path\to\repo (the sshfs is mounted as a UNC share on Windows).
  2. Try writing/patching an existing file in an existing folder, for example:
    update \sshfs...\e2e_mvp_hybrid\e2e_runbook_regtest.sh
    or add a file directly to \sshfs...\e2e_mvp_hybrid\newfile.txt
  3. Get an EPERM error … mkdir ‘\sshfs...\e2e_mvp_hybrid’.
  4. However, if you add a file to a new nested directory, for example:
    add \sshfs...\e2e_mvp_hybrid_tmp_random\test.txt
    the operation succeeds.

Expected Behavior

Expected behavior
When updating an existing file: do not mkdir at all (the parent already exists).
When adding a file: mkdir -p only for directories that actually do not exist, and correctly handle “already exists” errors on UNC/sshfs.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Version Information

Version: 2.4.22 (user setup)
VSCode Version: 1.105.1
Commit: 618c607a249dd7fd2ffc662c6531143833bebd40
Date: 2026-01-26T22:51:47.692Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.19045

For AI issues: which model did you use?

GPT-5.2

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report.

I can see the screenshot with the EPERM error during ApplyPatch. Cursor is trying to mkdir a directory that already exists e2e_mvp_hybrid when writing to a UNC path.

Your analysis is spot on. It looks like the file write pipeline on Windows doesn’t handle UNC/sshfs paths correctly. It calls mkdir even when the directory already exists, and sshfs returns EPERM instead of “already exists”.

I’ve passed this along to the team. Your details (the UNC path specifics, and the pattern that “new subfolders work, existing ones don’t”) will help them dig in.

For now, using a staging directory as a workaround is the only option. I know it’s annoying, but it keeps you unblocked.

Let me know if you find any other patterns.

Thank you very much for the quick response. I hope this gets fixed.
Regarding the current situation:
I tried the latest update.
The bug wasn’t fixed.
I just tried creating a file directly in the existing e2e_mvp_hybrid/, and the operation failed again with:
EPERM: operation not permitted, mkdir ‘\sshfs…\e2e_mvp_hybrid’
That is, the runtime still tries to mkdir the parent directory even when it already exists, and SSHFS prevents this.
The workaround is still the same: write to a new subfolder (unique each time) and then cp -f to the target file.

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When trying to create/edit a file directly in the root or inside of an existing directory (Network Unit attached with sshfs,a few weeks ago this scenario works properly) using the write tool, Cursor attempts to run mkdir on the parent directory even though it already exists. This results in a permissions error (EPERM).

Steps to Reproduce

Have an existing directory (example: X:\PROJECT_ROOT)

Try to create a file directly in the root of that directory using the write tool

Expected Behavior

The file should be created without any issues, since the parent directory already exists.

Operating System

Windows 10/11

Version Information

2.4.27 (user setup)

Additional Information

The issue does NOT occur when trying to create a file inside a non-existing subfolder (for example, with a random name).

In that case, Cursor correctly creates the folder and then creates the file.

The bug seems to be in the logic that checks whether the parent directory exists before trying to create it.

Does this stop you from using Cursor

No - Cursor works, but with this issue

I’ve found a workaround for this bug without having to work locally!!!

Since I saw that the problem was that Cursor doesn’t work well with SSHFS network drives, what I did was create a symlink in my local directory pointing to the shared folder using mklink /D. Then, in the multiroot workspace, I set the local directory C:\xxx\xxx\xxx\symlink_backend, and now it works perfectly!

Issue Still Occurring - EPERM Error with SSHFS on Windows (Started Feb 5th)

Issue Update

I want to report that this issue is still occurring, and it appears to have gotten worse starting around February 5th, 2026.

My Setup:

  • Windows 10/11 with SSHFS-Win

  • Mapped network drive: S:\ pointing to \\sshfs.r\[email protected]\path\to\dir\

  • Cursor was previously able to write to these files before Feb 5th

What Changed:

As of February 5th, 2026, all file write operations fail with the same EPERM error when using Cursor’s Write and StrReplace tools. For the output below, the “dev” directory exists and I am trying to write to a file in \dev.

Error: EPERM: operation not permitted, mkdir ‘s:\dev’

Testing Results:

I tested various scenarios to narrow down the issue:

  1. :white_check_mark: Write to C:\ drive - Works perfectly

  2. :cross_mark: Write tool to S:\ (SSHFS) - Fails with EPERM

  3. :cross_mark: StrReplace tool to S:\ (SSHFS) - Fails with EPERM

  4. :white_check_mark: Shell commands with required_permissions: [“all”] - Works (bypasses sandbox)

  5. :white_check_mark: Manual editing in Notepad - Works while Cursor is running

Diagnosis:

This appears to be a sandbox policy change that was introduced around February 5th. The sandbox now blocks write operations to mapped network drives (including SSHFS) unless the sandbox is completely disabled with required_permissions: [“all”].

Impact:

  • The Read tool works fine on SSHFS drives

  • All editing tools (Write, StrReplace) are blocked by the sandbox

  • The symlink workaround mentioned by @Soykheabro on Feb 4th may help, but it doesn’t address the root cause

  • This significantly impacts workflows for developers using remote filesystems via SSHFS

Request:

Since this worked perfectly before February 5th and suddenly stopped, this appears to be a regression introduced in a recent Cursor update. Could the team investigate what changed in the sandbox permissions around this date?

Cursor Version:

  • Date of issue onset: February 5th, 2026

  • Version: 2.4.28 (system setup)
    VSCode Version: 1.105.1
    Commit: f3f5cec40024283013878b50c4f9be4002e0b580
    Date: 2026-02-03T00:56:18.293Z
    Build Type: Stable
    Release Track: Default
    Electron: 39.2.7
    Chromium: 142.0.7444.235
    Node.js: 22.21.1
    V8: 14.2.231.21-electron.0
    OS: Windows_NT x64 10.0.26100

After updating to 2.4.31 (system setup) today, the issue persists. This is a huge blocker for my workflows.

Please advise.

1 Like

The issue persists today in 2.4.36 (system setup).

1 Like

Same issue on Cursor 2.4.37, Windows 10.

Confirmed that PowerShell can create directories on the same mount without issues, and other IDEs can edit files normally.

Cursor itself can edit files manually just fine.

The problem is specifically with **Write and StrReplace tools** (extension API) - they fail with EPERM mkdir error.

Tried disabling Git, remounting drive, changing writeFile strategy - nothing helps.

Remote-SSH extension is not an option as it hangs the server by consuming all resources.

This completely blocks AI assistant from editing remote files.

Everything was working so well until yesterday. Thx.

Any ETA on a fix?