Skip to main content

Fixing Cursor WSL Connection Errors

Cursor WSL Fix

Starting with Cursor 3.0.9, many users encountered a frustrating WSL connection error: Directory not found: --classic. This happens because the WSL shim used by Cursor becomes corrupted after the Glass (Agent) interface update. This guide provides a reliable fix.

Understanding the Problem

When you try to open a WSL folder in Cursor from the terminal, you may see:

Directory not found: --classic

This occurs because:

  • Cursor 3.0.9+ introduced the Glass (Agent) interface
  • The WSL shim script was not properly updated
  • The --classic flag is misinterpreted as a folder name

The Fix: Create a Smart Wrapper Script

Step 1: Locate Your Cursor Executable

Find where Cursor is installed on Windows:

# Common locations:
C:\Users\<username>\AppData\Local\Programs\cursor\Cursor.exe
# or
C:\Program Files\Cursor\Cursor.exe

Step 2: Create the Wrapper Script

Create a file named cursor-wsl in your WSL home directory (~/.local/bin/):

mkdir -p ~/.local/bin
cat > ~/.local/bin/cursor-wsl << 'EOF'
#!/bin/bash
# Smart wrapper for Cursor WSL connection
# Fixes the --classic directory error

WINDOWS_CURSOR="/mnt/c/Users/$(cmd.exe /c 'echo %USERNAME%' 2>/dev/null | tr -d '\r')/AppData/Local/Programs/cursor/Cursor.exe"

if [ ! -f "$WINDOWS_CURSOR" ]; then
WINDOWS_CURSOR="/mnt/c/Program Files/Cursor/Cursor.exe"
fi

if [ ! -f "$WINDOWS_CURSOR" ]; then
echo "Error: Could not find Cursor.exe"
echo "Please update WINDOWS_CURSOR path in this script"
exit 1
fi

# Convert WSL path to Windows path
WSL_PATH="$(wslpath -w "$PWD")"

# Launch Cursor with the correct path
"$WINDOWS_CURSOR" --classic "$WSL_PATH" "$@"
EOF

chmod +x ~/.local/bin/cursor-wsl

Step 3: Add to PATH

Add this to your ~/.bashrc or ~/.zshrc:

export PATH="$HOME/.local/bin:$PATH"

Then reload:

source ~/.bashrc  # or ~/.zshrc

Step 4: Create a Convenient Alias

Add to your shell config:

alias cursor='cursor-wsl'
alias c.='cursor-wsl .'

Alternative Fix: Direct Windows Path Method

If the wrapper doesn't work, use this direct approach:

# Add to ~/.bashrc
cursor() {
local win_path
win_path=$(wslpath -w "${1:-$PWD}")
/mnt/c/Users/$(cmd.exe /c 'echo %USERNAME%' | tr -d '\r')/AppData/Local/Programs/cursor/Cursor.exe --classic "$win_path"
}

Verifying the Fix

Test your setup:

# Navigate to a project
cd ~/my-project

# Open in Cursor
cursor .

# Or use the alias
c.

Cursor should now open without the --classic error.

Additional Tips

Update Cursor Path Automatically

If your Windows username changes or Cursor moves:

# Find Cursor automatically
find /mnt/c -name "Cursor.exe" -type f 2>/dev/null | head -1

Handle Spaces in Paths

If your Windows username has spaces, quote the path:

"$WINDOWS_CURSOR" --classic "$WSL_PATH"

WSL2 Specific Settings

For WSL2, ensure your /etc/wsl.conf allows Windows interop:

[interop]
enabled = true
appendWindowsPath = true

Then restart WSL:

wsl --shutdown

Troubleshooting

IssueSolution
command not found: cursor-wslEnsure ~/.local/bin is in your PATH
Cursor.exe not foundUpdate the path in the script to match your install location
Slow startupThis is normal for WSL→Windows interop; consider using VS Code Remote WSL instead
File watcher issuesAdd "files.watcherExclude" patterns in Cursor settings