WHMCS\Exception\InvalidDomain: The domain is invalid

Symptom

While managing a domain in the Admin Area, you see an Oops! error page that displays a The domain is invalid error:

ERROR: WHMCS\Exception\InvalidDomain: The domain is invalid. in /path/to/whmcs/vendor/whmcs/whmcs-foundation/lib/Domains/Idna.php:0

Cause

The value in the tbldomains.domain field of your MySQL® database contains an invalid character. For example, it may contain a blank space at the beginning or end.

The system validates the entered domain value to prevent invalid data. The invalid data in your database likely originated from an external source or something inserted it into the database directly.

Solution

Edit the record directly in the tbldomains table of the MySQL database to remove the invalid character from the domain field.