Plesk

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

Symptoms

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:

    #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

Exit mobile version