Cursor 2.5.17, Remote - SSH ( 1.0.40), Remote fails to start: "Command line too long"

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When attempting to connect to a Windows host over SSH, Cursor fails to start because it seems to be hitting the cmd.exe command length limit:

2026-02-20 13:01:12.185 [info] Resolving ssh remote authority '<redacted>' (Unparsed 'ssh-remote+7b22686f73744e616d65223a22776f726b73746174696f6e227d') (attempt #1)
2026-02-20 13:01:12.202 [info] SSH askpass server listening on /var/folders/0h/8yzn5_zj7_1c1jj6yj09xs040000gn/T/cursor-ssh-sXY2Vf/socket.sock
2026-02-20 13:01:12.203 [info] Using configured platform windows for remote host <redacted>
2026-02-20 13:01:12.207 [info] Using askpass script: /Users/<redacted>/.cursor/extensions/anysphere.remote-ssh-1.0.40/dist/scripts/launchSSHAskpass.sh with javascript file /Users/<redacted>/.cursor/extensions/anysphere.remote-ssh-1.0.40/dist/scripts/sshAskClient.js. Askpass handle: /var/folders/0h/8yzn5_zj7_1c1jj6yj09xs040000gn/T/cursor-ssh-sXY2Vf/socket.sock
2026-02-20 13:01:12.219 [info] Command length (8191 max): 8282
2026-02-20 13:01:12.219 [info] Command:  "Configuring Cursor Server on Remote"
$TMP_DIR="$env:TEMP\$([System.IO.Path]::GetRandomFileName())"
$ProgressPreference = "SilentlyContinue"
$DISTRO_COMMIT="7b98dcb824ea96c9c62362a5e80dbf0d1aae4770"
$PORT_RANGE=""
$SERVER_APP_NAME="cursor-server"
$SERVER_INITIAL_EXTENSIONS=""
$SERVER_DATA_DIR="$(Resolve-Path ~)\.cursor-server"
"Server data directory: $SERVER_DATA_DIR"

$env:VSCODE_AGENT_FOLDER = "$SERVER_DATA_DIR"
$env:VSCODE_SERVER_SHUTDOWN_TIMEOUT="300"

$SERVER_DIR=
$SERVER_NODE_EXECUTABLE=
$SERVER_SCRIPT=
$S_LOG="$SERVER_DATA_DIR\.$DISTRO_COMMIT.log"
$S_PID="$SERVER_DATA_DIR\.$DISTRO_COMMIT.pid"
$S_TOKEN="$SERVER_DATA_DIR\.$DISTRO_COMMIT.token"
$SERVER_ARCH=
$SERVER_CONNECTION_TOKEN=
$SERVER_DOWNLOAD_URL=
$SERVER_PID=
$LISTENING_ON=
$OS_RELEASE_ID=
$ARCH=
$PLATFORM="win32"
$SCRIPT_ID="d1b7b0eb10fc3c704eb5550d"
function printResults($code, $error, $fatal) {
"${SCRIPT_ID}: start"
"exitCode==$code=="
"errorMessage==$error=="
"isFatalError==$fatal=="
"codeListeningOn==$LISTENING_ON=="
"codeConnectionToken==$SERVER_CONNECTION_TOKEN=="
"nodeExecutable==$SERVER_NODE_EXECUTABLE=="
"detectedPlatform==$PLATFORM=="
"arch==$SERVER_ARCH=="
"SSH_AUTH_SOCK==$SSH_AUTH_SOCK=="
"DISPLAY==$DISPLAY=="
"${SCRIPT_ID}: end"
if ($code -eq 0) {
"!!! Closing this terminal will terminate the connection and disconnect Cursor from the remote server."
}

}

function exitClean($code, $error, $fatal) {
printResults $code $error $fatal
exit $code
}

if ($false -or $true) {
"Killing Cursor servers"
Get-Process node -ErrorAction SilentlyContinue | Where-Object Path -Like "$SERVER_DATA_DIR\bin\*" | Stop-Process -Force
}

if ($true) {
"Removing all existing Cursor installations"
"__CURSOR_LOCK_PREEMPT__ component=remote-ssh reason=forceReinstall lock_file=$SERVER_DATA_DIR/.installation_lock"
Remove-Item -Path "$SERVER_DATA_DIR/bin","$SERVER_DATA_DIR/*.log","$SERVER_DATA_DIR/*.token","$SERVER_DATA_DIR/.installation_lock" -Recurse -Force -ErrorAction SilentlyContinue
}

function acquireLock() {
$lockFilePath = (Join-Path "$SERVER_DIR" "cursor-remote.lock")
try {
$null = ni $lockFilePath -it f -ea si
} catch {
exitClean 1 "Error creating lock file: $($_.ToString())" "false"
}

for($I = 1; $I -le 30; $I++) {
try {
"Acquiring lock $lockFilePath"
$global:lockFile = [System.io.File]::Open($lockFilePath, 'Open', 'Read', 'None')
break
} catch {
"Install in progress - $($_.ToString())"
sleep -Milliseconds 1000
}

}

if($I -le 30) {
"Lock acquired"
} else {
exitClean 1 "Error could not acquire lock after $MAX_LOCK_ATTEMPTS attempts" "false"
}

}


$downloadUrl=
$ARCH=$env:PROCESSOR_ARCHITECTURE
if ($ARCH -eq "AMD64") {
$SERVER_ARCH="x64"
$downloadUrl='https://cursor.blob.core.windows.net/remote-releases/7b98dcb824ea96c9c62362a5e80dbf0d1aae4770/vscode-reh-win32-x64.tar.gz'
} elseif ($ARCH -eq "ARM64") {
$SERVER_ARCH="arm64"
$downloadUrl='https://cursor.blob.core.windows.net/remote-releases/7b98dcb824ea96c9c62362a5e80dbf0d1aae4770/vscode-reh-win32-arm64.tar.gz'
} else {
exitClean 1 "Error architecture not supported: $ARCH" "true"
}


$SERVER_DIR="$SERVER_DATA_DIR\bin\$PLATFORM-$SERVER_ARCH\$DISTRO_COMMIT"
$SERVER_NODE_EXECUTABLE="$SERVER_DIR\node.exe"
$SERVER_SCRIPT="$SERVER_DIR\bin\$SERVER_APP_NAME.cmd"
$env:PATH="$SERVER_DIR\bin\remote-cli;$env:PATH"

if(Test-Path "$SERVER_DATA_DIR\bin") {
Get-ChildItem "$SERVER_DATA_DIR\bin" -Directory | ForEach-Object {
$dirName = $_.Name
$dirPath = $_.FullName

if ($dirName -match "^(linux|darwin|win32|alpine)-(x64|arm64)$") {
$commits = Get-ChildItem $dirPath -Directory | Sort-Object LastWriteTime -Descending | Select-Object -Skip 5
foreach ($commit in $commits) {
$isRunning = Get-Process node -ErrorAction SilentlyContinue | Where-Object Path -Like "$($commit.FullName)\*"
if (-not $isRunning -and $commit.Name -ne $DISTRO_COMMIT) {
"Cleaning up stale build $($commit.Name) in $dirPath"
Remove-Item -Path $commit.FullName -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$SERVER_DATA_DIR.$($commit.Name).*" -Force -ErrorAction SilentlyContinue
}

}

} else {
$isRunning = Get-Process node -ErrorAction SilentlyContinue | Where-Object Path -Like "$dirPath\*"
if (-not $isRunning -and $dirName -ne $DISTRO_COMMIT) {
"Cleaning up old-style stale build $dirName"
Remove-Item -Path $dirPath -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$SERVER_DATA_DIR.$dirName.*" -Force -ErrorAction SilentlyContinue
}

}

}

}

if(!(Test-Path $SERVER_DIR)) {
try {
ni -it d $SERVER_DIR -f -ea si
} catch {
exitClean 1 "Error creating server install directory: $($_.ToString())" "false"
}

if(!(Test-Path $SERVER_DIR)) {
exitClean 1 "Error creating server install directory $SERVER_DIR" "false"
}

}

cd $SERVER_DIR
acquireLock
try {
if(!(Test-Path $SERVER_SCRIPT)) {
del cursor-server.tar.gz
$SCP_SERVER_PATH="$(Resolve-Path ~)\.cursor-server\cursor-server-<redacted>.tar.gz"
if(Test-Path "$SCP_SERVER_PATH") {
"Using server from $SCP_SERVER_PATH"
Move-Item "$SCP_SERVER_PATH" "cursor-server.tar.gz"
} else {
if($false -eq $true) {
exitClean 1 "Download failed: Failed to copy server from local client" "true"
}

"Downloading from $downloadUrl"
$REQUEST_ARGUMENTS = @{
Uri="$downloadUrl"
TimeoutSec=20
OutFile="cursor-server.tar.gz"
UseBasicParsing=$True
}

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
try {
Invoke-RestMethod @REQUEST_ARGUMENTS
} catch {
exitClean 1 "Download failed: $($_.ToString())" "false"
}

}

if(Test-Path "cursor-server.tar.gz") {
tar -xf cursor-server.tar.gz --strip-components 1
del cursor-server.tar.gz
}

if(!(Test-Path $SERVER_SCRIPT)) {
"Error while installing the server binary $SERVER_SCRIPT"
exit 1
}

}

else {
"Server already installed: $SERVER_SCRIPT"
}


if(Get-Process node -ErrorAction SilentlyContinue | Where-Object Path -Like "$SERVER_DIR\*") {
"Server already running $SERVER_SCRIPT"
}

else {
"Starting server $SERVER_SCRIPT"
if(Test-Path $S_LOG) {
del $S_LOG
}

if(Test-Path $S_PID) {
del $S_PID
}

if(Test-Path $S_TOKEN) {
del $S_TOKEN
}

$SERVER_CONNECTION_TOKEN="<redacted>"
[System.IO.File]::WriteAllLines($S_TOKEN, $SERVER_CONNECTION_TOKEN)

if ([string]::IsNullOrEmpty($PORT_RANGE)) {
$SERVER_PORT = 0
} else {
$SERVER_PORT = $PORT_RANGE
}

$ARGS="--start-server --host=127.0.0.1 --port=$SERVER_PORT $SERVER_INITIAL_EXTENSIONS --connection-token-file `"$S_TOKEN`" --telemetry-level off --enable-remote-auto-shutdown --accept-server-license-terms"
$S_CMD="& `"$SERVER_SCRIPT`" $ARGS *> `"$S_LOG`""
$ENCODED_COMMAND=[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($S_CMD))
$START_ARGUMENTS = @{
FilePath = "powershell.exe"
WindowStyle = "hidden"
ArgumentList = @(
"-ExecutionPolicy", "Unrestricted", "-NoLogo", "-NoProfile", "-NonInteractive", "-EncodedCommand", $ENCODED_COMMAND
)
PassThru = $True
}

$SERVER_ID = (start @START_ARGUMENTS).ID
if($SERVER_ID) {
[System.IO.File]::WriteAllLines($S_PID, $SERVER_ID)
}

}

if(Test-Path $S_TOKEN) {
$SERVER_CONNECTION_TOKEN="$(cat $S_TOKEN)"
}

else {
exitClean 1 "Server token file not found $S_TOKEN" "false"
}

sleep -Milliseconds 500
$SELECT_ARGUMENTS = @{
Path = $S_LOG
Pattern = "Extension host agent listening on (\d+)"
}

for($I = 1; $I -le 40; $I++) {
"Checking $S_LOG for port"
if(Test-Path $S_LOG) {
$GROUPS = (Select-String @SELECT_ARGUMENTS).Matches.Groups
if($GROUPS) {
$LISTENING_ON = $GROUPS[1].Value
"Listening on port: $LISTENING_ON"
break
}

}

sleep -Milliseconds 500
}

} finally {
$lockFile.Close()
}

if (!$LISTENING_ON) {
exitClean 1 "Error server did not start successfully. Could not extract server port from log file $S_LOG" "false"
}

if(!(Test-Path $S_LOG)) {
exitClean 1 "Error server log file not found $S_LOG" "false"
}

if(Test-Path $S_PID) {
$SERVER_PID="$(cat $S_PID)"
}

if(!$SERVER_PID) {
exitClean 1 "Error server pid file not found $S_PID" "false"
}

printResults 0 "" "false"
while($True) {
if(!(gps -Id $SERVER_PID)) {
"server died, exit"
exit 0
}

sleep 30
}


2026-02-20 13:01:12.219 [error] Error installing server: Command line too long
2026-02-20 13:01:12.220 [error] Error resolving SSH authority Command line too long

Steps to Reproduce

Attempt to SSH to a Windows host

Expected Behavior

Cursor is able to start a session over Remote SSH

Operating System

Windows 10/11
MacOS
Linux

Version Information

Version: 2.5.17
Commit: 7b98dcb824ea96c9c62362a5e80dbf0d1aae4770
Date: 2026-02-17T05:58:33.110Z (2 days ago)
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Cursor/2.5.17 Chrome/142.0.7444.265 Electron/39.3.0 Safari/537.36

Does this stop you from using Cursor

Yes - Cursor is unusable

Reverting Remote - SSH extension to 1.0.39 resolves the issue. Seems like 1.0.40 is broken. Please revert or fix

1 Like

Thanks for this, mine also broke and that fixed it!

1 Like

Same issue here, reverting the Remote SSH extension from Anysphere to 1.0.39 fixed it. Thanks @bytehow!

1 Like

Hey everyone! Thanks for the reports and the workaround. I’m following up with the team about this.

1 Like

How do I revert to 1.0.39? I’m using Cursor Linux. Edit: Nevermind. I found the drop down to revert to prior versions.

It seems like 1.0.40 has been unpublished

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.