0X0000274F

Fix WSAENAMETOOLONG (0X0000274F) in 3 Steps

Network & Connectivity Intermediate 👁 1 views 📅 May 28, 2026

Your app crashed because a file path or network name is too long. We'll shorten or remap it. Had a client lose a whole database backup from this.

The 30-Second Fix: Rename or Move the Problem File

This error shows up when Windows or an app tries to access a file path longer than 260 characters (old Win32 limit) or a network name exceeding 128 bytes. Most common trigger: you saved a file deep in folders like \\server\share\projects\client\reports\2025\Q1\draft\final\v2\backup\ and then tried to open it from a legacy app (e.g., an old accounting tool or a custom script).

Quick fix: Move that file closer to the root. Open File Explorer, cut the file from C:\Users\YourName\Documents\Work\Projects\Client\Reports\2025\Q1\draft\final\v2\backup\ and paste it directly to C:\Temp\. If the app now opens it fine, you've confirmed the path length is the problem. Rename the file to something short like data.txt while you're at it.

If this works, you're done. Took me 20 seconds on a client's machine last week.

The 5-Minute Fix: Enable Long Path Support in Windows 10/11

If moving the file isn't practical (e.g., it's on a network share you can't restructure), enable Windows' built-in long path support. Microsoft added this in Windows 10 version 1607, but it's off by default for security reasons.

Via Group Policy (Pro/Enterprise):

  1. Press Win + R, type gpedit.msc, hit Enter.
  2. Go to Computer Configuration > Administrative Templates > System > Filesystem.
  3. Double-click Enable Win32 long paths.
  4. Set it to Enabled, click OK.
  5. Reboot.

Via Registry (Home editions):

reg add "HKLM\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f

Then restart. This won't fix every app — the software itself has to be compiled to support long paths. But most modern apps (VS Code, Office 365, Python 3.6+) handle it. Old crappy LOB apps often don't. If this doesn't work, move to the next fix.

The 15-Minute Fix: Map a Short Drive Letter to the Deep Path

When you can't move files and long paths are still failing (usually on a network share or a deeply nested folder), use a mapped drive or a symbolic link to shorten the path the app sees.

Option A: Map a network drive

  1. Open File Explorer, right-click This PC, select Map network drive.
  2. Pick a drive letter (e.g., Z:).
  3. In the folder box, paste the full path to the deepest directory you need, like \\server\share\projects\client\reports\2025\Q1\draft\final\v2\backup\.
  4. Check Reconnect at sign-in, click Finish.
  5. Now your app can access Z:\ instead of that long string. This bypasses the 260-character limit because the mount point is short.

Option B: Use a symbolic link (local or network)

If you can't map a drive (e.g., you're on a local folder), create a directory junction, which acts like an alias.

mklink /J C:\ShortPath "C:\Users\YourName\Documents\Work\Projects\Client\Reports\2025\Q1\draft\final\v2\backup\"

Now point your app to C:\ShortPath. The OS follows the link transparently. I've used this dozens of times for legacy apps that choke on deep paths.

The Nuclear Option: Rewrite the App or Upgrade

If you wrote the app yourself and it's hitting Winsock's WSAENAMETOOLONG (error code 10061 in decimal, or 0X0000274F), you're probably using connect() or sendto() with a name longer than 128 bytes. That's a hard limit in the Windows Sockets API for hostname resolution. Shorten the hostname or use IP addresses. Had a client whose internal server name was this-is-a-very-long-server-name-that-should-never-be-this-long.domain.company.internal — 130+ bytes. Renamed it, problem gone.

If it's a third-party app that's hard-coded to use long names internally, your only real fix is upgrading to a modern version or switching tools. No registry hack will override Winsock's limits.

What Actually Causes 0X0000274F

Two scenarios, and you need to figure out which one you're in:

  • File path too long (most common): Windows or the app tries to open/create a file with a path >260 characters. The Winsock error code is misleading — it's actually a file system limit.
  • Network name too long (rare): The hostname or service name passed to a socket function exceeds 128 bytes. Usually in custom code.

How to tell which: If the error happens when opening/saving a file, it's the first. If it happens on a network call (e.g., connecting to a database), it's the second.

Prevention

  • Keep folder structures shallow. Max 4-5 levels.
  • Use short, meaningful names: clnt_rpts_q1 instead of Client_Reports_2025_Quarter_1_draft_final_v2.
  • On network shares, set up DFS namespaces with short aliases.
  • Test any new app with a path of 200+ characters during pilot deployment. It'll save you a fire drill later.
“Last year, a client's entire CRM went down because a backup script created files with paths over 300 chars. Mapped a drive, fixed in 10 minutes. They were about to pay for a server migration.”

Was this solution helpful?