Tips & Tricks: Duplicate entry error message in Drupal

- Tags:

Combining several modules in Drupal can sometimes result in strange error messages. In this post some common errors and solutions are mentioned.

I really love Drupal. Actually sometimes It is not 'just' a CMS. It is a complete environment. Every time I need something I take a look at the Drupal Modules  and the functionality is already there (or for 90%).

However sometimes when you install modules, they can conflict with each other or you need some more modules to get it working. Most of the time you get good support at the module pages but it can take some time to find the right solution. In this blog I will give a short overview of the error messages we see quite often and how we solve them. We will update this blog in the future with new tips & tricks.

User warning: Duplicate entry '21854-0' for key 'PRIMARY'
Go to the system table in your database and change:
  • weight of the content.module -> -1
  • weight trigger.module -> 1 (or the module which is mentioned in the error message).

Modify weight for fields in Content Type

In order to have the computed fields calculated correctly, you need to modify the weight of the 'Field Operations Global' and 'Field Operations Contenttype'. You can change these weights manually by disabling javascript. You can only do this in Firefox.

  • Make sure you have installed the 'Web Developer' addon in FireFox.
  • Go the 'Manage Fields' for the ContentType you want to change.
  • Go to Tools > Web Developer > Disable > Disable Javascript > All Javascript.
  • Now you can adjust the weight of each field. Make sure the fields specified above have the largest weight.