You click Create a New Domain in cPanel’s Domains interface, type a domain name, and cPanel refuses it because the domain already exists. That means some record on the server still claims the name, even when no account seems to use it. The fix is to find that one record, whether it sits in an account, a leftover file or a DNS zone, and remove only it. The wording of the error varies. It may mention the userdata, another user who owns the domain, or a DNS entry that must be removed from every server in the DNS cluster. It usually shows up after a site moved between accounts, after an account was terminated or transferred, or when someone added the domain once and forgot it. The steps are for server admins with root access, and they also tell a cPanel user what to ask their host for.
What you’ll accomplish
- Ask cPanel which account, if any, owns the domain right now.
- Check each place the server records a domain: the account files, the lookup maps, the per-domain settings, the DNS zone and any DNS cluster peer.
- Decide whether you face a live domain on another account, an orphaned DNS zone, or stale records left by an unfinished removal.
- Remove the leftover in a way that does not come back on the next rebuild.
- Add the domain to the right account and prove the server agrees on who owns it.
Prerequisites
You need root access to WHM (WebHost Manager, the server admin panel) and root SSH access for the file checks. The whmapi1 command is WHM’s API on the command line; it is installed with cPanel and runs as root. The commands match current cPanel & WHM releases on AlmaLinux, Rocky Linux or CloudLinux.
If you are a cPanel user without root, you can still do the first check yourself. Open Domains in your own account and make sure the name is not already listed there as a domain, alias or subdomain. If it is not, send your host the exact error text and the domain name, and ask them to run the ownership check in step 2.
The examples use these names. Replace them with your own.
shop.example.netis the domain you are trying to add.newshopis the account that should get it.oldshopis an account that held it before.
How it works
cPanel records each domain in several places. When you add one, cPanel writes it into all of these records, and its checks read those records before it accepts a new name. If any of them still holds the name, the add fails.
/var/cpanel/users/<user>is each account’s main settings file. It lists the account’s domains on lines such asDNS1=shop.example.net./etc/userdomainsmaps every domain to its account./etc/trueuserdomainsdoes the same for main domains only. WHM’supdateuserdomainsfunction rebuilds/etc/userdomainsfrom the files in/var/cpanel/users./var/cpanel/userdata/<user>/holds the per-domain settings: document root, IP address, aliases. Itsmainfile lists the account’s domains. An addon domain’s settings file is named after the subdomain cPanel creates for it, not after the addon domain itself. Apache’s configuration is built from these files./etc/userdatadomainsis a one-line-per-domain cache built from that userdata. Each line records the owner, the domain type (main, addon, parked or sub), the document root and a few more fields./var/named/shop.example.net.dbis the DNS zone file. A zone can outlive the account that created it.- In a DNS cluster, which is a group of servers that share DNS zones, a peer server can keep its own copy of the zone.
The diagram shows these records, the command that checks each one, and the most common leftover.
The arrows matter. The map files are rebuilt from the account files and userdata. If you delete a line from /etc/userdomains but leave the source in /var/cpanel/users, the line returns on the next rebuild.
Step-by-step
Run the checks in steps 1 to 6 first. They change nothing. Then pick the fix that matches what you found.
1. Write down the exact message and where it appeared. Copy the full error text. Note whether it came from cPanel’s Domains interface, from WHM’s account creation, or from an account restore or transfer. A message that names a DNS entry and the DNS cluster points at a zone. A message about userdata or another user points at the account records. If the error came from creating a whole account, our guide to WHM account creation failures covers the other stages that can fail.
2. Ask cPanel who owns the domain.
whmapi1 getdomainowner domain=shop.example.net
Example output when an account still owns it:
---
data:
user: oldshop
metadata:
command: getdomainowner
reason: OK
result: 1
version: 1
A username means a live account still holds the domain. user: ~ (empty) means no account owns it, so the problem is a leftover record. Keep the answer; the next steps confirm it.
3. Search the lookup maps. grep -F treats the dots in the name as plain dots, and -w stops myshop.example.net from matching.
grep -Fw shop.example.net /etc/userdomains /etc/trueuserdomains
grep -Fw shop.example.net /etc/userdatadomains | awk -F'==' '{print $1, $2, $3}'
Example output:
/etc/userdomains:shop.example.net: oldshop
shop.example.net: oldshop root addon
Read the second line from left to right. It gives the domain and its owner account, then the reseller that owns that account, then the domain type. Here shop.example.net is an addon domain on oldshop. No output from both commands means neither map knows the name.
4. Search the account files and userdata. These are the sources the maps are built from.
grep -Fw shop.example.net /var/cpanel/users/*
grep -rlFw shop.example.net /var/cpanel/userdata/ | grep -v cache
Example output:
/var/cpanel/users/oldshop:DNS1=shop.example.net
/var/cpanel/userdata/oldshop/main
/var/cpanel/userdata/oldshop/shop.oldmain.com
The second file is the account’s domain list. The third is the settings file of the subdomain behind the addon domain. To see which subdomain that is, read the matching line in main.
grep -Fw shop.example.net /var/cpanel/userdata/oldshop/main
Example output:
shop.example.net: shop.oldmain.com
Keep that subdomain name for step 8. Note which usernames appear. Then check whether each one is a real account today.
whmapi1 listaccts search=oldshop searchtype=user searchmethod=exact want=user,domain
If the output lists user: oldshop with its main domain, the account exists. An empty acct list means the account is gone and its files are leftovers.
5. Check for a DNS zone on this server.
ls -l /var/named/shop.example.net.db
whmapi1 listzones | grep -A1 'domain: shop.example.net$'
Example output:
-rw-r----- 1 named named 1104 Mar 12 2026 /var/named/shop.example.net.db
domain: shop.example.net
zonefile: shop.example.net.db
A zone file with no owner from step 2 is an orphaned zone. ls printing “No such file or directory” and an empty listzones result mean there is no local zone.
6. Check DNS cluster peers. First see whether clustering is on, and which peers are configured.
ls /var/cpanel/useclusteringdns && ls /var/cpanel/cluster/root/config/
Example output:
/var/cpanel/useclusteringdns
ns2.example-dns.net ns2.example-dns.net-dnsrole
“No such file or directory” means clustering is off, so skip ahead. Otherwise ask each peer for the zone’s SOA record, the record that marks a server as holding a zone.
dig @ns2.example-dns.net shop.example.net SOA +short
Example output:
ns1.example-dns.net. hostmaster.example.net. 2026031204 3600 1800 1209600 86400
An answer means the peer still holds a copy. An empty answer means it does not. For a cluster that refuses to sync at all, see our guide to debugging DNS cluster sync failures.
7. Match what you found to a case.
| What steps 2 to 6 showed | Case | Fix |
|---|---|---|
getdomainowner names a real account | Live domain on another account | Step 8 |
No owner, but /var/named has a zone | Orphaned zone | Step 9 |
| No owner, but account files or userdata still name it | Stale records | Step 10 |
Local checks clean, a peer answers dig | Zone on a cluster peer | Step 11 |
8. Live domain on another account: remove it there first. Confirm with the account’s owner that the domain should move, and make sure a recent backup of that account exists. Then delete the domain from that account only. In the account’s own cPanel, use Domains and the delete action. From the command line:
whmapi1 delete_domain domain=shop.example.net
Example output:
---
data:
type: addon
username: oldshop
metadata:
command: delete_domain
reason: OK
result: 1
version: 1
For an addon domain, cPanel also created a subdomain on the old account, such as shop.oldmain.com from step 4. The API documentation notes that delete_domain does not remove it, so run the same command for that subdomain once the first one succeeds.
whmapi1 delete_domain domain=shop.oldmain.com
This time the output should show type: sub and result: 1. The function handles addon, parked and sub domains, not an account’s main domain. If shop.example.net is the old account’s main domain, change it first in WHM » Modify an Account, or move the whole account.
9. Orphaned zone: delete it. Check once more that getdomainowner from step 2 showed no owner, then copy the zone file somewhere safe. Deleting a zone a live site still uses takes its DNS offline.
cp -a /var/named/shop.example.net.db /root/shop.example.net.db.bak
In WHM, open Delete a DNS Zone, select shop.example.net, click Delete, and confirm. From the command line:
whmapi1 killdns domain=shop.example.net
Example output:
---
metadata:
command: killdns
output:
raw: shop.example.net => deleted from host1.
reason: Zones Removed
result: 1
version: 1
cPanel’s API documentation warns that killdns does not remove the XDNS entry that the adddns function writes into the owner’s file in /var/cpanel/users. Until that entry is gone, cPanel can still treat the name as taken. If step 4 found a line like XDNS1=shop.example.net, remove it as described in step 10.
10. Stale records: fix the source, then rebuild. Back up both sources before you edit anything.
cp -a /var/cpanel/users/oldshop /root/oldshop.users.bak
cp -a /var/cpanel/userdata/oldshop /root/oldshop.userdata.bak
If the account still exists, open /var/cpanel/users/oldshop in an editor and delete only the DNSn= or XDNSn= line that names shop.example.net. If the account no longer exists, move its leftover files aside rather than deleting them.
mv /var/cpanel/users/oldshop /root/oldshop.users.orphan
mv /var/cpanel/userdata/oldshop /root/oldshop.userdata.orphan
If the account still exists, leave its userdata folder in place. When a settings file for the domain or its addon subdomain remains there, try delete_domain from step 8 first, because it cleans up every record at once. Then rebuild the maps and the web server configuration.
whmapi1 updateuserdomains
/usr/local/cpanel/scripts/updateuserdatacache
/usr/local/cpanel/scripts/rebuildhttpdconf
/usr/local/cpanel/scripts/restartsrv_httpd
updateuserdomains should end with result: 1. rebuildhttpdconf should end with a line like Built /etc/apache2/conf/httpd.conf OK. If the stale entry also left a zone file, delete it as in step 9.
11. Zone on a cluster peer: delete it on the peer. cPanel’s API documentation notes that killdns cannot delete zones that live on cluster servers with the write-only role. Log in to the peer’s own WHM and delete the zone there, or run whmapi1 killdns domain=shop.example.net on the peer as root. Repeat the dig from step 6 until the peer gives an empty answer.
12. Add the domain again. Log in to cPanel as newshop, open Domains, click Create a New Domain, and enter shop.example.net. It should be accepted and appear in the list.
Validate it works
Ask cPanel again who owns the domain.
whmapi1 getdomainowner domain=shop.example.net
The output should show user: newshop. Then confirm the maps agree.
grep -Fw shop.example.net /etc/userdomains
grep -rlFw shop.example.net /var/cpanel/users/
Example output:
shop.example.net: newshop
/var/cpanel/users/newshop
Only newshop should appear in both. Finally, check that the new zone answers locally and on each peer.
dig @127.0.0.1 shop.example.net SOA +short
dig @ns2.example-dns.net shop.example.net SOA +short
Both should return an SOA line with the same serial number, the 10-digit value after the email address. A peer that lags may take a few minutes to catch up.
Troubleshooting
The line comes back after you delete it. You removed a map entry but not its source. Search /var/cpanel/users/ and /var/cpanel/userdata/ again (step 4), fix the source as in step 10, and rerun the rebuild commands.
killdns reports a failure or no change. Check whether the zone lives only on a peer (step 6). Also check that the server’s DNS role is enabled in WHM » Server Profile, because cPanel disables killdns when the DNS role is off.
The error now points at the Apache configuration. The account records may be clean while httpd.conf still holds an old virtual host, the block that tells Apache how to serve one site. Run /usr/local/cpanel/scripts/rebuildhttpdconf and restart Apache with restartsrv_httpd, as in step 10.
An account restore or transfer fails with the same message. The destination server still holds the name from an earlier attempt or another account. Run steps 2 to 6 on the destination, clear the leftover, and start the restore again.
getdomainowner shows an owner, but that account’s Domains page does not list it. The account’s records disagree with each other. Treat it as stale records (step 10) on that account, and keep the backup until the account’s sites and mail work.
When this is the wrong approach
If a live account owns the domain and you cannot confirm the owner agrees, stop. Removing a domain that a customer still uses takes their site and email offline. Check with the account holder or the domain’s registrant first.
If you want the same domain on two accounts, cPanel will not allow it. You can split subdomains across accounts instead, as explained in sharing one domain across cPanel accounts.
If a whole account is moving to this server, use WHM’s transfer tools rather than re-adding domains one at a time. The transfer brings mail, databases and DNS along. Clear any leftovers first so the restore does not hit this error.
If you are not root, do not try to edit these files through a support workaround. Send your host the error text and the domain name, and let them run the checks above.
For the full reference on each API function used here, see the WHM API documentation and the cPanel & WHM documentation.
If this is the kind of work you’d rather never own again, it’s the daily job of Managed Cloud Ops — book an infrastructure review.