Things have come to a virtual standstill on a CiviCRM/Drupal7 installation. CiviCRM page loads (and reloads) are taking a minute or more, but do eventually load. Another two installations on the same server are unaffected.

Perhaps related, I had just upgraded the mosaico extension from the beta to the release version and the mosaico menus are absent from 'Mailings'.

I have tried clearing the caches and rebuilding the menus.

Advice and insights would be gratefully received.

The log shows:

CRM_Core_Exception: Invalid Filter in CRM_Core_BAO_CustomGroup::validateSubTypeByEntity() 
(line 689 of /var/www/clients/client4/web5/web/sites/all/modules/civicrm/CRM/Core/BAO/CustomGroup.php).


$backTrace = 
  #0 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/CRM/Core/Error.php(229): CRM_Core_Error::backtrace("backTrace", TRUE) 
  #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error)) 
  #2 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error)) 
  #3 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: already exists", -5, 16, (Array:2), "INSERT INTO civicrm_menu (domain_id , path , path_arguments , title , access_...") 
  #4 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/PEAR.php(575): DB_Error->__construct(-5, 16, (Array:2), "INSERT INTO civicrm_menu (domain_id , path , path_arguments , title , access_...") 
  #5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -5, NULL, NULL, "INSERT INTO civicrm_menu (domain_id , path , path_arguments , title , access_...", "DB_Error", TRUE) 
  #6 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8)) 
  #7 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7)) 
  #8 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -5, NULL, NULL, "INSERT INTO civicrm_menu (domain_id , path , path_arguments , title , access_...", "DB_Error", TRUE) 
  #9 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-5, NULL, NULL, NULL, "1062 ** Duplicate entry 'civicrm/contact/view/note-1' for key 'UI_path_domain...") 
  #10 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError() 
  #11 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_menu (domain_id , path , path_arguments , title , access_...") 
  #12 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/DB/DataObject.php(2446): DB_common->query("INSERT INTO civicrm_menu (domain_id , path , path_arguments , title , access_...") 
  #13 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/packages/DB/DataObject.php(1068): DB_DataObject->_query("INSERT INTO civicrm_menu (domain_id , path , path_arguments , title , access_...") 
  #14 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/CRM/Core/DAO.php(495): DB_DataObject->insert() 
  #15 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/CRM/Core/Menu.php(309): CRM_Core_DAO->save() 
  #16 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(185): CRM_Core_Menu::store(FALSE) 
  #17 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(83): CRM_Core_Invoke::getItem((Array:2)) 
  #18 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:2)) 
  #19 /var/www/clients/client4/web5/web/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:2)) 
  #20 [internal function](): civicrm_invoke("admin") 
  #21 /var/www/clients/client4/web5/web/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:1)) 
  #22 /var/www/clients/client4/web5/web/index.php(21): menu_execute_active_handler() 
  #23 {main}

4 Answers 4


Tracked down the cause. It was some 'bad' (non-numeric?) values in civicrm_custom_group.extends_entity_column_value, such as 'media_info', 'Funder' & 'Elected_Info_Ind'. Perhaps a legacy from an old module or extension? Deleted these, errors disappeared & performance excellent.


From the error, it seems you have double entry for path, domain_id combo in civicrm_menu table. This need to be unique as it has an index created over it.

Try deleting the one row from civicrm_menu table that contains a duplicate values for path and domain_id.

Eg. Run this query

SELECT id, path, domain_id 
FROM civicrm_menu
WHERE path = 'civicrm/contact/view/note';

If this contains two rows with same domain_id - delete one of them -> rebuild menu and check if this fixes the issue for you.

  • Thank you for your help. The query returns: MySQL returned an empty result set (i.e. zero rows). (Query took 0.0001 seconds.) SELECT id, path, domain_id FROM civicrm_menu WHERE path = 'civicrm/contact/view/note-1'
    – Bryan
    Jul 26, 2017 at 5:40
  • And by sorting the table and eyeballing I can see no duplicate for this path…
    – Bryan
    Jul 26, 2017 at 6:35
  • Not sure if it's of relevance but the value in the table is 'civicrm/contact/view/note' not 'civicrm/contact/view/note-1'. Is there something going on the code to account for duplicates?
    – Bryan
    Jul 26, 2017 at 7:35
  • Yes, the value need to be civicrm/contact/view/note and not note-1, 1 is the domain_id. I've updated the answer, but seems you've already checked for duplicate values in this table. I mentioned because this is what the error message in the backtrace meant to be. Not sure if it is related to the exect issue you're seeing. Jul 26, 2017 at 9:51
  • What about the log message about 'Invalid Filter'? It appears to relate dto custom groups, of which I have many. Not sure how this relates to the backtrace, but the error occurs in the log with every menu action. Also, not sure if I made it plain, all the actions/page loads succeed, very slowly but without a visible error unless debugging switched on.
    – Bryan
    Jul 26, 2017 at 22:57

I had a similar but different issue creating indices for contact_id case_id in that table. Had to remove before rerunning. Sadly no "IF NOT EXISTS" is available for CREATE INDEX.


I had this same issue when an organisation was being stored as an individual. So the main contact type was set to individual. This meant that the organisation contact sub type did not match the correct set of sub types for individual.

I changed the contact type in the database directly for that organisation (civicrm_contact).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.