Opening cursor on a WSL repo sometimes has issues reading/writing files, has stale worktree read/write, and makes the ide entirely unsuable for writing, edits, chat, etc

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Opening cursor on a WSL repo sometimes has issues reading/writing files, has stale worktree read/write, and makes the ide entirely unsuable for writing, edits, chat, etc.

Steps to Reproduce

Open cursor to a wsl workspace and this sometimes happens

Expected Behavior

I’m not sure what it’s trying to save (generally worktree stuff)

Operating System

Windows 10/11

Version Information

Version: 3.6.25 (user setup)
VS Code Extension API: 1.105.1
Commit: 4982b875023dade3256ff3975584317bd94cfdc0
Date: 2026-05-30T01:45:04.973Z
Layout: editor
Build Type: Stable
Release Track: Nightly
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
xterm.js: 6.1.0-beta.220
OS: Windows_NT x64 10.0.26200

Additional Information

Been happening for months

Does this stop you from using Cursor

Yes - Cursor is unusable

Anyone have a fix for this one? I’ve found deleting worktrees for that project sometimes works, and relaunching a few times also sometimes works.

That’s what it’ll look like, you’ll see a bunch of files saying that, and chat will not work at all. Seems to be related to the project, as I’ll have one cursor window open on another workspace working fine, and then have to reopen the new window a few times to get the new one working, but it happens when its the only window as well, not reliant on that.

A few things that should help:

  1. Update to the latest Nightly. A fix for stale file read/write state landed on June 5, after your current build (3.6.25, May 30). That may clear up the stale worktree behavior on its own.

  2. Next time it happens, grab the console logs. Open Help → Toggle Developer Tools → Console and copy any red errors — especially anything mentioning resolveAuthority, remote-wsl, or file sync. That lets us pin down which WSL issue you’re hitting. Reporting a bug walks through it.

  3. Is the repo on the native Linux filesystem (/home/...) or a Windows-mounted path (/mnt/c/...)? Operations over /mnt/c go through a slower cross-OS bridge and can stall exactly like this.

Deleting the project’s worktrees and relaunching is a reasonable stopgap until we narrow this down.

I’m not the OP, but I’ve been running into this issue lately as well. WSL works great, until it doesn’t…then it just really struggles to resolve itself.

“Connection to Cursor server failed: Failed to connect to Cursor server from Windows. Please try rebooting WSL by running “wsl -d ubuntu --shutdown” and then reconnect.”

I just updated Cursor so I’ll test it again. From what I can tell, my issue (can’t speak for others) is related to Vite. If Vite is running, the likelihood I face WSL issues increases drastically. It’ll work well “for a while”, but eventually it screws up and fails to establish consistent connection, attempting to reconnect on a loop every 20 seconds or so.

As I’ve tried to troubleshoot this in the past, Cursor has attempted to assist me and diagnose the issue. This is an incomplete snippet of some of the conversation:

Cursor's client ↔ WSL management connection is dropping and reconnecting on a ~20-second loop. Each reconnect re-fires the "Setting up WSL" toast. The connection works(that's why your session and the app are fine), but the WebSocket keepalive keeps timing out — classic WSL2loopback networking instability, which also explains every flaky symptom today (port 5173 unreachable, Docker proxy resets).

That's the key: with NAT mode, Windows reaches WSL through a localhost-forwarding relay, and that relay is exactly what degrades over a long session or after sleep. It's the common root cause behind everything you hit today — port 5173 unreachable, Docker proxy resets, and now the ~20s cursor-server reconnect loop.

I’ve just installed the latest Cursor update, so I’ll test Vite again today (it’s really convenient to use in combination with Agents Window → Design mode–so I hope it works properly again). I’ll report back if I face issues–no update means it’s probably resolved.

UPDATE: I’ve resolve my issue related to Vite. Here is what Cursor had to say:

You were right — this wasn't a hostname typo. The real bug is in how server.origin interacts with CORS in the Laravel Vite plugin.

Actual root cause

Your console error is the smoking gun:

Access-Control-Allow-Origin has a value http://127.0.0.1:5173 that is not equal to the supplied origin http://127.0.0.1:8000

Vite was telling the browser: "only :5173 is allowed" — but the page loading the scripts is on :8000. So CORS blocked every module script regardless of hostname.

I reproduced this from WSL:

curl -H "Origin: http://127.0.0.1:8000" http://127.0.0.1:5173/@vite/client

# → Access-Control-Allow-Origin: http://127.0.0.1:5173  ❌

Why: vite.config.ts sets server.origin to the Vite dev URL (needed for WSL/HMR). But laravel-vite-plugin uses that same value as the CORS allowlist when it's explicitly set:

index.jsLines 56-66

        server: {

          origin: userConfig.server?.origin ?? "http://__laravel_vite_placeholder__.test",

          cors: userConfig.server?.cors ?? {

origin: userConfig.server?.origin ?? [

defaultAllowedOrigins,

...env.APP_URL ? [env.APP_URL] : [],

/^https?:\/\/.*\.test(:\d+)?$/

]

},

Without an explicit server.origin, the plugin defaults CORS to allow loopback addresses and APP_URL. Once we set server.origin for WSL, that default was replaced — and CORS broke.

Fix applied

I updated vite.config.ts to explicitly allow the Laravel app origin:

vite.config.tsLines 106-108

        cors: {

            origin: [loopbackOriginPattern, appOrigin],

},

This mirrors the plugin's default behavior while keeping the WSL server.origin setting.

What you need to do

Restart Vite so it picks up the config change:

Ctrl+C on the running npm run dev

SKIP_WAYFINDER=true npm run dev

Reload http://127.0.0.1:8000/login

After restart, DevTools should show no CORS errors and the login page should render.

To verify the fix took effect, you can run in PowerShell:

curl.exe -I -H "Origin: http://127.0.0.1:8000" http://127.0.0.1:5173/@vite/client

You should see Access-Control-Allow-Origin: http://127.0.0.1:8000 instead of :5173.

Sorry the earlier hostname theory was a red herring — your Chrome logs made the real issue clear.

Worth separating the two things you hit, since they have different causes:

1. The Vite/CORS error (Access-Control-Allow-Origin … :5173 vs :8000) was an app-side config issue in your vite.config.ts / Laravel Vite plugin, not Cursor. Your fix - explicitly allowing the Laravel app origin in cors.origin while keeping server.origin for WSL/HMR - is exactly right. Good catch.

2. The “Failed to connect to Cursor server from Windows” reconnect loop is a separate issue from the file-write/worktree problem this thread is about. It’s a known WSL2 networking instability pattern: Windows can’t consistently reach the Cursor server running in your WSL distro, so it drops and re-attempts every ~20s even though the session is technically alive. A couple of things that help:

  • The wsl --shutdown + reconnect reset you already found is the quickest unblock.
  • If you’re running WSL2 in mirrored networking mode (set in %UserProfile%\.wslconfig as networkingMode=mirrored), try switching back to the default NAT mode. Mirrored mode is the most common trigger for this loopback flakiness, and it tends to degrade over long sessions or after sleep, which matches what you’re seeing.

If the reconnect loop keeps happening after your latest update, would you mind opening a new thread for it? It’s a different root cause than the file-write issue in this one, and a separate thread (with your DevTools console errors — Help → Toggle Developer Tools → Console) lets us track it properly. Reporting a bug covers grabbing those logs.