Primary domain change - error "(XID f4wjpq) The domain “...” already exists in the userdata.

glmanager

Member
Jun 14, 2022
15
0
1
Chatswood
cPanel Access Level
Reseller Owner
Hi All,

I have domains a number of domains (say domain1.com, domain2.com and domain.3 com) with one domain primary.
I need to change the primary domain to another one and when I try to do that I get an error message.

" (XID f4wjpq) The domain “...” already exists in the userdata. at /usr/local/cpanel/Whostmgr/Accounts/Modify.pm line 945. "

Please advise how to resolve it.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,495
2,605
363
cPanel Access Level
Root Administrator
Hey there! The easiest thing to do would be to search through the files in /var/cpanel/userdata to see if there is already an entry for the domain name you are trying to change to. That would show you what account the domain exists under so you can get that removed.
 

glmanager

Member
Jun 14, 2022
15
0
1
Chatswood
cPanel Access Level
Reseller Owner
Hi cPRex,

Thanks for your reply.
I went to /var/cpanel/userdata and can see the domain I want to make a primary domain.
However I inside /var/cpanel/userdata/username I can only see 2 domains out of 6 listed in cpanel management webpage.

What I basically need is making site.com as a primary domain instead of site3.com without removing and domain.
If I try to do that from WHM Home / Accounts Functions / Modify an Account I'm getting " (XID f4wjpq) The domain “...” already exists in the userdata. at /usr/local/cpanel/Whostmgr/Accounts/Modify.pm line 945. "
 

Attachments

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,495
2,605
363
cPanel Access Level
Root Administrator
Thanks for those details - there isn't a great way to do that without removing the domain first, as it already has an entry on the server. It might be best to rename these to fictitious domains and then change them back to what you'd ultimately like them to be.
 

glmanager

Member
Jun 14, 2022
15
0
1
Chatswood
cPanel Access Level
Reseller Owner
OK so this is what I have now:
I can't modify\change primary domain.
At the same time I can't delete the primary domain (as I understand this is by cPanel design).
If I rename the primary domain in /var/cpanel/userdata would that potentially break anything?
 

rpsimao

Registered
Dec 5, 2022
1
0
1
Portugal
cPanel Access Level
Root Administrator
Just to leave here how I solved this issue:

1) nano /etc/userdatadomains
Remove the domain from this file

2) cd /var/cpanel/databases
Remove all json files from that domain, including the grant_*** files

3) rm -r /var/cpanel/userdata/domain.tld
remove the domain dir (replace domain.tld with your own)

Then I restore the account from the backup using WHM -> Home / Transfers / Transfer or Restore a cPanel Account

Kudos to this script: GitHub - CpanelInc/tech-acctinfo

I used the --cruft option. With that output I could figure it out

I hope someone find this useful.
It was driving me insane...
 
Last edited: