Username already exists in CPanel
Q: When iPanel/iHost tries to create an account in CPanel and the username already exists in CPanel, CPanel obviously cannot create the account. Why doesn't iPanel/iHost check to see if the username already exists in CPanel?
iPanel/iHost (hereafter referred to collectively as iPanel) does check to see if the username exists in CPanel during ordering -- that's what iPanel does when it displays "Validating your account information" on the order form after the account details are submitted. There are a few scenarios that iPanel cannot account for, however, and one of these is likely the reason for the duplicate-username error you're encountering:
Are you using a CPanel reseller account (instead of the 'root' account)? If you have a reseller account, and there are other resellers on the same server, one of the other resellers may have a user account with the same username as the account you're trying to create. CPanel will not tell iPanel about accounts owned by other resellers, so iPanel has no way of knowing what usernames they have taken. Do you have any other scripts that provision accounts in CPanel, and/or do you provision any accounts by hand? There is the (very rare) possibility that a user may sign up with a given username, and then that same username may be taken by another script (or created by hand) before iPanel is able to provision it. Again, however, this is exceedingly rare. Is your CPanel in good working order? Our staff have encountered scenarios wherein CPanel can sometimes fail to provision an account on the first attempt (due to problems in CPanel, unrelated to iPanel), but in some cases it may accidentally leave the UNIX user account intact on the server despite failing. So after that first provisioning attempt fails, iPanel sees that an error took place, and tries to re-provision the account on the next cron job run. And at that point, CPanel returns a "Username already in use" error since the UNIX user account still exists from the first (failed) provisioning job. This indicates a problem in CPanel and will need to be diagnosed by a qualified CPanel administrator.