Articles in this section

Unable to activate the mail service on a domain: mailmng-outgoing failed: ERROR:__main__:UNIQUE constraint failed: vhost_ids.guid

kb: technical

Symptoms

  • Mail service cannot be activated on example.com. One of the following errors is displayed:

    PLESK_ERROR: mailmng-outgoing failed: ERROR:__main__:UNIQUE constraint failed: vhost_ids.guid

    PLESK_ERROR: mailmng-outgoing failed: ERROR:__main__:NOT NULL constraint failed: vhost_ids.domain_id

Cause

An orphaned entry with the guid of example.com already exists in the vhost_ids table of the outgoing mail limits /var/lib/plesk/mail/outgoing/data.db database.

Resolution

One domain is affected
  1. Connect to the server via SSH

  2. Enable debug.
  3. Reproduce the error.
  4. Find the following entry in /var/log/plesk/panel.log:

    CONFIG_TEXT: #7 /opt/psa/admin/plib/Mail/AbstractFacade.php(1670): Service_Driver_Mail_Plesk_Domain_Unix->addVhostId(string 'example.com', string '22ddab34-a039-4ef1-9f4c-cbeba73463fb')

  5. Disable debug.
  6. Backup the outgoing mail database:

    # cp /var/lib/plesk/mail/outgoing/data.db{,.bkp}

  7. Open the outgoing mail database:

    # sqlite3 /var/lib/plesk/mail/outgoing/data.db

  8. Check if the entry with guid from step 4 is in there:

    # sqlite> select * from vhost_ids where guid="22ddab34-a039-4ef1-9f4c-cbeba73463fb";
    22ddab34-a039-4ef1-9f4c-cbeba73463fb|49

  9. Check if it is orphaned(no domains with such id's in the domains table):

    # sqlite> select * from domains where id=49

  10. Resolve the inconsistency:
    • If the output in step 9 was empty, remove the orphaned entry from the vhosts_ids table:

      # sqlite> delete from vhost_ids where guid="22ddab34-a039-4ef1-9f4c-cbeba73463fb";

    • If the output in step 9 was not empty, apply the below solution from the "Multiple domains are affected" section. 
Multiple domains are affected
  1. Connect to the server via SSH
  2. Backup the outgoing mail control database:

    # cp /var/lib/plesk/mail/outgoing/data.db{,.bkp}

  3. Wipe the outgoing mail control database:

    # plesk sbin mailmng-outgoing --destroy

  4. Recreate it:

    # plesk sbin mailmng-outgoing --init

Was this article helpful?

Comments

1 comment
Date Votes

Please sign in to leave a comment.