Write and StrReplace tools return "Invalid arguments" when workspace is opened via Remote-SSH (Mac → Windows)

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

The Write and StrReplace tools (used by the AI to create and edit files) consistently return “Invalid arguments” when the workspace is opened via Remote-SSH from a Mac to a Windows host. The same tools work when the workspace is opened locally on either Mac or Windows. Read and terminal/shell tools work over SSH; only Write and StrReplace fail.

Steps to Reproduce

  1. On a Mac, connect to a Windows machine using Cursor’s Remote-SSH (Remote - SSH) and open any project folder on the Windows host.
  2. Start a new chat and ask the AI to create a file (e.g. “Create a file at test.txt in the project root with content ‘hello’”).
  3. Ask the AI to edit that file (e.g. “Replace ‘hello’ with ‘world’ in that file”).
  4. Observe: the AI’s Write and StrReplace tool calls return “Invalid arguments”. The same test run locally on the Mac or locally on the Windows machine succeeds.

Expected Behavior

Write and StrReplace should succeed over Remote-SSH to a Windows host, just as they do when the workspace is opened locally on Mac or Windows. File paths (relative or absolute) should be accepted and the file created/updated.

Operating System

Windows 10/11
MacOS

Version Information

Version: 2.4.28
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: Darwin x64 23.4.0

For AI issues: which model did you use?

Model selection: Auto. I don’t see which model was used in the chat.

Additional Information

Test matrix (same “create file + StrReplace” test in a new chat each time):

  • Local Mac, new workspace: Success
  • Local Mac, existing workspace: Success
  • Local Windows, new workspace: Success
  • Local Windows, existing workspace: Success
  • SSH (Mac → Windows), new workspace: Fail (“Invalid arguments”)
  • SSH (Mac → Windows), existing workspace: Fail (“Invalid arguments”)

Workaround: When using Remote-SSH to Windows, use terminal commands (e.g. PowerShell Set-Content) to create/overwrite files, or open the folder locally on the Windows machine when the AI needs to use Write/StrReplace.

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the detailed report. This is really helpful.

This is a known regression related to parsing Windows paths in Remote SSH sessions. The root cause is a UriError that happens when the agent tries to resolve file paths over an SSH connection to a Windows host. This has been reported a few times already, and it tends to come back in different versions.

Temporary workaround: try switching the bottom panel from Terminal to Output before running agent commands. In some cases this prevents the path parsing issue because the terminal context does not get collected.

Related threads:

A few questions to narrow it down:

  1. When Write/StrReplace crashes, do you see a UriError in the devtools console (Help > Toggle Developer Tools > Console tab)?
  2. Is the Terminal panel open or visible when the error happens?
  3. Which Remote SSH extension are you using, Anysphere or Microsoft? (CMD+Shift+X > search “Remote-SSH” > check the publisher)

The team is aware of this issue. Let me know if the Output panel workaround changes anything.

Temporary workaround: try switching the bottom panel from Terminal to Output before running agent commands. In some cases this prevents the path parsing issue because the terminal context does not get collected.

Thanks i’m not seeing how this changes anything since i’m running into this bug in agent chats. The work around that’s worked has been setting up the following rule in cursorrules. Imperfect:

File Edits Fallback (Remote-SSH to Windows)

Why this is in place: When this workspace is opened via Remote-SSH from a Mac to a Windows host, Cursor’s Write and StrReplace tools consistently return “Invalid arguments.” The same tools work when the workspace is opened locally (Mac or Windows). This is a known Cursor limitation in the Remote-SSH (Mac to Windows) scenario. Until Cursor fixes it, use the fallback below when the tools fail.

Conditional behavior: Use Write and StrReplace as usual when they succeed (e.g. when working locally). Only when Write or StrReplace return “Invalid arguments” should you retry using PowerShell as described below.

Fallback procedure: If the Write or StrReplace tools return “Invalid arguments”:

  • Retry using PowerShell from the project (workspace) root.
  • Create/overwrite: Set-Content -Path "path\to\file" -Value "content". For multi-line content use an array of lines or a here-string (@" ... "@); prefer single quotes to avoid escaping.
  • Replace text: (Get-Content -Raw "path\to\file") -replace 'old','new' | Set-Content "path\to\file". When the text to replace contains regex metacharacters (e.g. . [ ] ( ) * $), use [regex]::Escape('old') for the first argument: -replace [regex]::Escape('old'), 'new'. Omit -NoNewline unless you intend to strip a trailing newline (otherwise the file may lose its final newline).
  • Use paths relative to project root in both cases.

Alternatively, i’ve moved back to running cursor locally where needed.


To your questions:

When Write/StrReplace crashes, do you see a UriError in the devtools console (Help > Toggle Developer Tools > Console tab)?

No i don’t see UriError.

Is the Terminal panel open or visible when the error happens?

No the terminal open or visible when the error happens.

Which Remote SSH extension are you using, Anysphere or Microsoft? (CMD+Shift+X > search “Remote-SSH” > check the publisher)

Anysphere. Had issues getting microsoft to work initially.

I encountered the same issue. I temporarily resolved it by rolling back to version 2.2.44, but I still hope to use the latest version.

1 Like

Thank you. This is a solid suggestion. I didn’t even think of this as an option.

I’ve sourced versions here: GitHub - oslook/cursor-ai-downloads: All Cursor AI's official download links for both the latest and older versions, making it easy for you to update, downgrade, and choose any version. 🚀, https://cursor.uuid.site/.

Thanks again

Hi guys. Same issue — the strreplace and write tools are returning “invalid arguments.” Rolling back to version 2.2.44 fixed it. Are the developers aware of this?

The second response in this threads by a mod suggests they are aware.

I have been hitting this same issue and have no workaround. What’s the ETA of the fix?

The workarounds are described in the messages above. Rollback to an older version of Cursor. Links re provided in one of the messages above.