3

Drupal version 7.34, CiviCRM version 4.5.5

Hi, When I try to install Views and CTools on our Intranet installation, I am getting the following error from Drupal:

Exception: API error: DB Error: already exists in CRM_Core_ManagedEntities->onApiError() (line 396 of /srv/www/htdocs/drupal/sites/all/modules/civicrm/CRM/Core/ManagedEntities.php)

(currently, CIviCRM is the only module installed)

Is this something that upgrading both CiviCRM and Drupal will fix?

5

It looks like CiviCRM is trying to insert some "Managed Entities" which already exist in the DB. Certain actions within the Drupal CMS will trigger CiviCRM to attempt this, and enabling / disabling modules is one of them.

What I might do in this situation (if I had to fix it without upgrading CiviCRM) is:

  • Make a backup of your DB. Make two.
  • Look in CiviCRM's debug logfile for ManagedEntities_failed - this has additional information to the Exception message you posted above.
  • Review the entry which CiviCRM was unable to insert to the DB (because a conflicting entry already existed).
  • If the entry CiviCRM tried to insert matches closely to an entry in the DB, then remove the DB entry you find and hope that when CiviCRM re-inserts the same, it "sticks" the second time around.
  • You might need to repeat this process, so pay attention to any new errors in the same logfile, and see if they are clashing with new entries or the same one ...
  • 2
    The logfile revealed that it was trying to add one of the built-in relationship types - we had deleted four of them via the UI in order to simplify things, but they were still in the database. – Richard Grevers Sep 17 '15 at 1:13
2

If CiviCRM is the only module installed, consider upgrading to the current release if at all possible.

Doing this is likely to fix a lot of bugs, and may well address your problem. It will also address multiple security issues fixed between 4.5.5 and the current release, which is probably just as important to you and your contacts. We strongly recommend keeping up to date with a supported CiviCRM release.

If you have a compelling reason to stick with 4.5.5, then consider the workaround in my other answer.

2

Looks very similar to the error message I got after upgrading to 4.6.8 which was affecting every Drupal module or CiviCRM extension I tried to install.

Reproduce the same conditions in order to reproduce the error and then look at the day's log file in sites/default/files/civicrm/ConfigAndLog This might give you some clue what was the cause.

In my case it was choking on pre-installed and unwanted demo Cases. After disabling them I got things running error free again.

2

I've had the same issue on 4.6.8. Couldn't install any Drupal modules after creating a custom CiviCRM case type. Getting the same Drupal log error as seen above (Exception: API error: DB Error: already exists in CRM_Core_ManagedEntities->onApiError() (line ...).

Disabling the case type allows the Drupal modules to be installed.

Olly

0

After looking at "sites/default/files/civicrm/ConfigAndLog", I have found that disabled "Relationship Type" under "Administer/Customize Data and Screens/Relationship Type/" was causing the error. After deleting relationship, error was gone.

version 4.6.15

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.