How to Fix "DNS Entry Already Exists" Error in cPanel and WHM Make it Rain Paper

  • DNS, DNS Configuration, DNS Management
  • 0

Pre-requirements

  • Access to WHM or root-level SSH access to the server.
  • Familiarity with cPanel user accounts and DNS zone management.
  • Basic knowledge of Linux commands.

Introduction

When attempting to add a domain or subdomain in cPanel, you may encounter the error:

"There was an error when the system attempted to create the alias. (XID haj58w) A DNS entry for 'example_domain.com' already exists."

This error indicates that the domain or subdomain you are trying to add already has a DNS zone or entry on the server. This guide explains how to resolve this issue by removing the existing DNS entry, either through the WHM interface or by using command-line tools.

Error Description

The "DNS Entry Already Exists" error occurs when the server has an existing DNS zone for the domain you are trying to add, or when a specific DNS record already exists in the zone file. This can also happen if a subdomain that is part of an addon domain is already present.

Steps to Fix "DNS Entry Already Exists" Error

Step Description Linux Command Windows Command (via SSH)
1. Log into WHM or via SSH Access the server using WHM or SSH to manage the DNS zone entries.
ssh root@yourserverIP
ssh root@yourserverIP
2. Remove DNS Zone via WHM To delete the DNS zone for the domain in question via WHM, navigate to Home » DNS Functions » Delete a DNS Zone, and select the domain. This will remove the DNS zone for the domain from the server. No specific command. Managed via WHM interface.
3. Remove DNS Zone via Command Line (WHM API) If you prefer using the command line, the WHM API can be used to remove the DNS zone. Replace "example.com" with the domain name.
whmapi1 --output=jsonpretty killdns domain='example.com'
whmapi1 --output=jsonpretty killdns domain='example.com'
4. Verify the DNS Entry (Optional) Before or after removing the DNS zone, you can check the user's DNS entries to ensure the record is removed. Replace $user_name with the cPanel username.
cat /var/cpanel/userdata/$user_name/main
cat /var/cpanel/userdata/$user_name/main
5. Remove DNS Entry Using Scripts If you prefer using a script, you can use the /scripts/killdns script to remove the DNS entry. Replace "example.com" with the domain name.
/scripts/killdns example.com
/scripts/killdns example.com
6. Add the Domain Again Once the DNS entry has been successfully removed, you can go back to cPanel and add the domain or subdomain without encountering the error. No specific command. Managed via cPanel interface.

Gotchas to Avoid

  • Incorrect Domain: Double-check the domain name you are trying to add to avoid removing the wrong DNS zone.
  • DNS Propagation Delay: After deleting the DNS zone, you may need to wait for DNS propagation to complete before attempting to add the domain again.

The "DNS Entry Already Exists" error in cPanel and WHM occurs when a domain or subdomain already has a DNS zone or entry. By following the steps outlined in this guide, you can resolve the issue and successfully add the domain. Always verify that the correct DNS zone or entry is removed to avoid accidentally deleting the wrong records.


Did this answer help?

« Back