Unable to load object of type BsDomain with id=: Domain does not exist.

Created:

2016-11-16 13:02:01 UTC

Modified:

2017-08-16 16:32:44 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Unable to load object of type BsDomain with id=: Domain does not exist.

Applicable to:

  • Plesk 10.x for Windows
  • Plesk 12.5 for Linux
  • Plesk 10.x for Linux
  • Plesk 11.x for Linux
  • Plesk 11.x for Windows
  • Plesk 12.0 for Windows
  • Plesk 12.0 for Linux
  • Plesk 12.5 for Windows

Symptoms

The following error occurs during an attempt to open a domain control panel in Plesk or open the Home > Domains link in the left navigation frame:

Unable to load object of type BsDomain with id=: Domain does not exist.

Cause

The issue is caused by a psa database inconsistency. It occurs if a record in the 'domains.webspace_id' or 'domain_aliases.dom_id' columns points to a non-existing domain ID.

Resolution

For Plesk 12.5 or higher try "plesk repair db" utility first. Please refer to the documentation

If it did not help use the solution below:

  1. Create a database backup:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin psa > psa`date +%F_%H.%M`.sql
  2. Check the links to '<id from error>' in the 'psa.domains' table:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e"select * from domains where webspace_id='< id from error >'"

    The above query will return a list of domains that belong to a broken webspace, if there are any.

  3. Check the domain-related tables and domain aliases:

    # for table in domain_aliases hosting dom_param DomainServices subdomains;do echo TABLE: $table; MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e"select * from $table where dom_id=<id from error>";done

    This query will return domain aliases that belong to the missing 'dom_id' and also entries in related tables that contain information about the domain.

  4. If the 'hosting\\DomainServices' tables returned a non-empty result on step 2, check whether the actual domain content folder exists (the 'www_root' value from the 'hosting' table) :

        ls -la /var/www/vhosts/example.com/httpdocs

    If it does, the domain entry in the database should be recreated. YFetch it from Plesk database dumps using the below command:

    # export dom_id=<dom_id that you got from hosting table>

    # find /var/lib/psa/dumps/ -name mysql.daily.dump.*|sort -n -r|while read dump_file;do zcat $dump_file|sed -n '/^INSERT INTO `domains/,/\\;/p'|grep -v ALTER|sed 's/INSERT INTO `domains` VALUES //g'|sed 's/),(/)\
    (/g'|grep '"("$dom_id'; if [ $? == 0 ];then echo;echo Dump file $dump_file contains the entry;exit 0;fi;done
    (2,'2013-11-21','domain.com','domain.com',3,0,'vrt_hst',760319296,1,0,NULL,NULL,'53238f70-4818-49a3-8d7e-1a5220e0e06e','','false','on',1,0,0,0,0)

    Dump file /var/lib/psa/dumps/mysql.daily.dump.8.gz contains the entry

    The above command will return the domain entry from Plesk database dumps if it exists there. Re-insert the entry into the domains table:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa -e"INSERT INTO domains VALUES(2,'2013-11-21','domain.com','domain.com',3,0,'vrt_hst',760319296,1,0,NULL,NULL,'53238f70-4818-49a3-8d7e-1a5220e0e06e','','false','on',1,0,0,0,0);"
  5. If the domain entry is missing in the dumps and the content folder does not exist, set the 'dom_id' to 0 for all the domains that have 'webspace_id' pointing to the missing domain. Also, remove entries from the following tables:

    mysql> begin;
    mysql> DELETE FROM hosting WHERE dom_id = <id from error>;
    mysql> DELETE FROM dom_param WHERE dom_id = <id from error>;
    mysql> DELETE FROM domainServices WHERE dom_id = <id from error>;
    mysql> DELETE FROM domain_aliases WHERE dom_id = <id from error>;
    mysql> DELETE FROM subdomains WHERE dom_id = <id from error>;
    mysql> commit;
  6. If the content folder is in place but the domain entry is missing, please create a support request in order to resolve the issue.

Have more questions? Submit a request
Please sign in to leave a comment.