This might occurs when domain name never shows up under Add-on Domains in cPanel but actually it does exists anywhere in the cPanel configuration. Following is the way defined below, to remove any trace of the domain from cPanel configuration manually.
1.) Firstly you need to verify if the domain is owned by any particular user by following command,
/scripts/whoowns mydomain.com owner
#grep mydomain.com /etc/userdomains
2.) Now you need to check if the zone file for the domain exists.
# ls -ld /var/named/mydomain.com.db
If there exists a zone file for the domain, then remove the zone by executing the following command:
# /scripts/killdns mydomain.com
3.) Now check cPanel user files, to see if there exists any traces of the domain:
# grep mydomain.com /var/cpanel/users/*
# grep -R mydomain.com /var/cpanel/userdata/*
Binary file /var/cpanel/userdata/owner/main.cache matches
/var/cpanel/userdata/owner/main /var/cpanel/userdata/owner/main: mydomain.com: mydomain.testdomain.com
/var/cpanel/userdata/owner/cache: mydomain.com: mydomain.testdomain.com
Edit any files that are found and remove the entire line that contains the domain name. Once you’ve done this, there shouldn’t be any entry for mydomain.com in the cPanel configuration file.
4.) Rebuild the User domain database:
Rebuild the Apache configuration
5.) Now, restart the Web Server as the configuration file is altered.
If the server is running on apache
# service httpd restart
If the server is running on LiteSpeed:
# service lsws restart
Once all these steps are done, you should be able to add mydomain.com as an Add-on domain under the account ‘owner’.