0X00002AF9

WSAHOST_NOT_FOUND (0X00002AF9) – No such host

This WinSock error means your app can't resolve a hostname to an IP. Usually it's a DNS glitch or a stale cache. Here's the quick fix and the deeper ones.

Cause #1: Stale DNS Cache (the most common fix)

80% of the time this error shows up because Windows is holding onto a bad DNS record. You'll see it in browsers, command-line tools, or custom apps trying to connect to a server that just moved IPs.

ipconfig /flushdns

Run that as admin. Then try your app again. If that doesn't work, also run:

ipconfig /registerdns
net stop dnscache && net start dnscache

This clears the local resolver cache and forces a fresh lookup. I've seen this fix the issue on Windows 10 22H2 and Windows Server 2019 after a network change or a VPN drop.

Cause #2: Corrupted Hosts File or Wrong Entries

Sometimes someone (or some malware) adds a bad entry to C:\Windows\System32\drivers\etc\hosts. Open that file in Notepad as admin. Look for lines like:

127.0.0.1   example.com

If the hostname you're trying to reach is mapped to a wrong IP, you get 0X00002AF9. Delete any suspicious lines. Also check for duplicate entries. The file should look clean — only localhost lines by default.

After editing, save it and flush DNS again. I've seen a single extra line in the hosts file cause this exact error for Outlook connecting to Exchange.

Cause #3: Firewall or Proxy Blocking DNS Queries

Your firewall or a corporate proxy can silently drop DNS requests. The error code might pop up even when the host is valid. Check these:

  • Turn off Windows Defender Firewall temporarily (test only).
  • Try a different DNS server: nslookup example.com 8.8.8.8
  • Check proxy settings in Internet Options -> Connections -> LAN settings.

If you use a VPN, disconnect and test. Some VPN clients alter DNS settings badly. I've fixed this error on a client's laptop by switching from the corporate DNS to Cloudflare (1.1.1.1) in the network adapter settings.

Less Common but Worth Trying

Winsock Reset

If the above fails, reset the Winsock catalog. This is a nuclear option for socket problems.

netsh winsock reset
netsh int ip reset

Reboot after running those. This clears any corrupted socket states.

Check the Hostname Spelling

I know it sounds stupid, but verify the hostname in your app. Typos cause this error all the time. Try pinging the hostname directly: ping yourhostname. If that fails, it's a DNS problem. If it works, your app might be using the wrong port or protocol.

Quick-Reference Summary Table

CauseFixCommand/Step
Stale DNS cacheFlush DNSipconfig /flushdns
Corrupted hosts fileEdit hosts fileDelete bad entries
Firewall/proxy blockingTest with alternate DNSnslookup hostname 8.8.8.8
Winsock corruptionReset Winsocknetsh winsock reset
Typo in hostnameDouble-check spellingUse ping to test

This error is annoying but almost always fixable in under 5 minutes. Start with the DNS flush, don't waste time rebooting. If you're on a corporate network, talk to your network team about DNS server health.

Related Errors in Windows Errors
0XC014000F ACPI Invalid Data (0XC014000F) – The Real Fix 0XC0262104 Fix ERROR_GRAPHICS_TRY_AGAIN_LATER (0XC0262104) on Windows 0X000003EA Fix ERROR_INVALID_MESSAGE (0X000003EA) on Windows Fast 0X8029010C TPM 0x8029010C: Unexpected result from TPM chip

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.