Flush DNS and Switch Servers: Open Command Prompt as Administrator
👇 See all 2 solutions below
What is Error 4058?
Windows System Error Code 4058, known as PEERDIST_ERROR_ALREADY_EXISTS, is a DNS & WINS error that occurs during DNS resolution and WINS name resolution. The error indicates that: An element already exists and was not replaced. When this error is encountered, the Windows operating system was unable to complete the requested operation within the DNS/WINS services subsystem. The error code 4058 is returned by the GetLastError() function and provides developers with a specific identifier to diagnose the root cause of the failure. The symbolic name PEERDIST_ERROR_ALREADY_EXISTS maps directly to this numeric code and is commonly referenced in Microsoft documentation, developer forums, and system logs. Understanding this error and its context within DNS resolution and WINS name resolution is essential for effective troubleshooting.
Common Causes
- System resource conflict: An element already exists and was not replaced.
- DNS server misconfigured
- Stale DNS cache entries
- Hostname cannot be resolved
Resolving Component Store (WinSxS) Bloat and Corruption
An encyclopedia on the Windows Component Store: safely reclaiming disk space, understanding hard links, and fixing deep WinSxS corruption.
Read the full guide →Step-by-Step Solutions
- Open Command Prompt as Administrator
- Run: ipconfig /flushdns
- Change DNS to Google (8.8.8.8) or Cloudflare (1.1.1.1)
- Run: ipconfig /registerdns
Video Tutorials
Diagnostic Command
Run this PowerShell command to find related events in your system log:
Get-EventLog -LogName System -Newest 20 | Where-Object {$_.Message -like "*4058*" -or $_.Message -like "*PEERDIST_ERROR_ALREADY_EXISTS*"} | Format-List
💡 Open PowerShell as Administrator, paste the command above, and press Enter.
Prevention Tips
- Use reliable DNS (8.8.8.8 or 1.1.1.1)
- Flush DNS cache periodically
- Monitor DNS resolution performance