You're copying a file, running a backup, or hitting an API and Windows throws WSAEREMOTE (0x00002757) — "Item is not available locally." Frustratingly vague. What's actually happening here is that some code called a Win32 or Winsock function against a resource (a file handle, a named pipe, a socket buffer, a device) that the local machine doesn't own. The resource lives on another node, and the call has no way to satisfy it locally.
This shows up most in three places: mapped network drives that dropped mid-copy, DFS-replicated folders where the referral points at a server you can't reach, and container/WSL workloads accessing a UNC path. It also pops up in .NET FileStream code when someone passes a UNC path to a constructor that only accepts local paths.
Work down this list. Stop when it clears.
Fix 1 — The 30-second fix: re-establish the remote handle
Nine times out of ten the remote session behind the handle went away. The local stub is still hanging around, still trying to read from a pipe that no longer exists on the other end.
- Close the app that threw the error. Fully. Not minimized — closed.
- Open Command Prompt and run:
net use * /delete /y
net use Z: \\server\share /persistent:yes
The reason step 2 works is that net use * /delete tears down every stale SMB session, not just the one you're looking at. Windows keeps per-user SMB sessions cached for hours; a dropped tunnel between your laptop and the file server leaves the session object alive from the OS's point of view. Deleting and reconnecting forces a fresh negotiate.
If you're on Wi-Fi and the machine roamed between APs, this is almost always the trigger. SMB doesn't survive a network switch cleanly.
Fix 2 — The 5-minute fix: find the actual remote dependency
If reconnecting didn't help, something in the call chain is pointing at a resource you don't realize is remote. Common culprits:
- A
.configorappsettings.jsonwith a UNC path (\\fileserver\data\...) that used to be a local path. - An environment variable like
TEMPorUSERPROFILEredirected to a network home directory (roaming profiles do this). - A symlink or junction pointing at
\\?\UNC\....
Check the obvious one first — the temp path:
echo %TEMP%
echo %TMP%
fsutil reparsepoint query "C:\path\to\suspicious\folder"
If %TEMP% resolves to a UNC path and that share is momentarily unreachable, any process that touches a temp file — which is basically every process — will start throwing WSAEREMOTE. The real fix is to point TEMP at a local disk. On Windows 10 21H2 and Windows 11 22H2+, roaming profile temp redirection is a known pain point when VPNs flap.
For .NET specifically: if you see this in a stack trace from FileStream, someone's passing a UNC path where the API only accepts a mapped drive letter. Either map the drive first or switch to FileStream's UNC-safe overloads (they exist since .NET Framework 4.6.2).
Fix 3 — The 15-minute fix: DFS, offline files, and the referral cache
If you're on a domain and the path goes through DFS (\\domain\namespace\...), the client caches referrals to specific servers. When a target server goes down or gets rebalanced, the cache still points at it and the local SMB stack returns WSAEREMOTE because the referred resource can't be reached locally.
Flush the referral cache:
dfsutil /pktflush
dfsutil /spcflush
ipconfig /flushdns
nbtstat -R
Then force offline files to reconcile — a half-synced offline cache is another classic source of this error:
Get-ChildItem "C:\Windows\CSC" -Recurse | Format-List
# or the supported tool:
mobsync.exe /reset
Don't run mobsync /reset on a laptop with unsynced work — it'll drop the cache. Sync first.
For containers and WSL2 hitting a Windows UNC path, the issue is different: the Linux side sees the mount but the underlying SMB handle is owned by the Windows host. If the host's SMB session dropped, the guest gets WSAEREMOTE via the 9P filesystem. Restart the WSL distro (wsl --shutdown) after reconnecting the host share.
When it's none of the above
Run a network trace and look for the actual failure:
netsh trace start capture=yes persistent=no tracefile=C:\temp\wsatrace.etl
# reproduce the error, then:
netsh trace stop
Open the .etl in Microsoft Network Monitor or Wireshark. You're looking for a TCP RST or a STATUS_NETWORK_NAME_DELETED on an SMB2 session. That tells you whether the server dropped you, a firewall killed the session mid-stream, or the client gave up on a referral. Each one points to a different owner — server team, network team, or endpoint team. Don't guess. The trace names the guilty party in under a minute.
One more thing worth checking: third-party VPN clients (looking at you, older Cisco AnyConnect splits) sometimes intercept\\UNC traffic and route it into the tunnel even when it should go out the local NIC. If you seeWSAEREMOTEonly when VPN is up, that's your culprit. Add an exclusion route for the file server subnet.
The error code looks scary because it's a Winsock constant leaking out of a higher-level API. It's not a bug in your code, and it's not memory corruption. It's Windows telling you, honestly, that the thing you asked for doesn't live here — and the fix is almost always about reconnecting, re-pointing, or un-caching the remote side of a call you didn't realize was remote.