Bug Report: EPERM error when writing files into existing directories (sshfs)

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

Hey, thanks for the report.

This is a duplicate. The exact same issue was described here a few days ago: Sshfs write to exist dir issue

The bug is confirmed. Cursor is handling UNC/sshfs paths on Windows incorrectly and is trying to run mkdir on directories that already exist, which causes an EPERM error. The team is aware and the bug has been logged.

A post was merged into an existing topic: Sshfs write to exist dir issue