Error message:

user warning: Duplicate entry '2569' for key 1 query: INSERT INTO url_alias_extra (pid, dst, entity_type, entity_id, created_by) VALUES (2569, 'user/jgoldberg/track/feed', 'tracker', 125, 'Pathauto') in /var/www/localhost/htdocs/drupal6/sites/all/modules/pathauto/pathauto.inc
on line 355.

The section of code in pathauto_create_alias that adds aliases for */feed paths does not check to see if an old alias exists. When _pathauto_set_alias is called, since $old_alias is not marked, the function assumes a prior alias does not exist and attempts an insert, and a duplicate entry warning occurs.

CommentFileSizeAuthor
pathauto.inc_.patch1.29 KBjgoldberg

Comments

greggles’s picture

I'm likely to commit this, but can you clarify the exact steps to reproduce? I haven't encountered this bug just yet.

Thanks, very much!

jgoldberg’s picture

I was able to reproduce it with a fresh Drupal instance.

Steps to reproduce:

1) Have both Pathauto and Tracker modules enabled
3) In the Pathauto settings, check "Bulk generate" and "Create feed aliases" under User-tracker
4) Go to My Account
5) Press Save

greggles’s picture

Status: Needs review » Fixed

Applied to both 5.x and HEAD (6.x). Thanks very much, jgoldberg! http://drupal.org/cvs?commit=97483

There was a slight code style issue I fixed. In the else block you forgot to add 2 spaces to indent the $update_data line. Small issue, of course, but something to watch for in the future...which, I hope there will be a future of you helping to fix bugs in Pathauto ;)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

michelle’s picture

Version: 6.x-1.x-dev » 5.x-2.1
Status: Closed (fixed) » Active

I've got a client getting this error in 5.x-2.1. Haven't tried the dev, yet. Should I?

Michelle

michelle’s picture

Status: Active » Closed (fixed)

Actually, nevermind. I _thought_ he was on 2.1 but he was actually on a slightly older version. Upgrading to 2.1 fixed it.

Michelle

Jean-Philippe Fleury’s picture

I have a "Duplicate entry" warning with Drupal 6.9, Pathauto 6.x-1.1 and Path Redirect 6.x-1.0-beta1. In the page /admin/build/path/pathauto, if I check "Bulk generate aliases for terms that are not aliased" in the "Taxonomy term path settings" section, I have these warning:

    * Les options de configuration ont été enregistrées.
    * Mise à jour en masse des termes terminée ; 6 alias générés.

    * user warning: Duplicate entry 'taxonomy/term/1' for key 2 query: INSERT INTO drupal_path_redirect (path, redirect, query, fragment, type) VALUES ('taxonomy/term/1', 'taxonomy/term/', '', '', '301') in /var/alternc/html/drupal/sites/all/modules/path_redirect/path_redirect.module on line 144.
    * user warning: Duplicate entry 'taxonomy/term/2' for key 2 query: INSERT INTO drupal_path_redirect (path, redirect, query, fragment, type) VALUES ('taxonomy/term/2', 'taxonomy/term/', '', '', '301') in /var/alternc/html/drupal/sites/all/modules/path_redirect/path_redirect.module on line 144.
    * user warning: Duplicate entry 'taxonomy/term/3' for key 2 query: INSERT INTO drupal_path_redirect (path, redirect, query, fragment, type) VALUES ('taxonomy/term/3', 'taxonomy/term/', '', '', '301') in /var/alternc/html/drupal/sites/all/modules/path_redirect/path_redirect.module on line 144.
    * user warning: Duplicate entry 'taxonomy/term/4' for key 2 query: INSERT INTO drupal_path_redirect (path, redirect, query, fragment, type) VALUES ('taxonomy/term/4', 'taxonomy/term/', '', '', '301') in /var/alternc/html/drupal/sites/all/modules/path_redirect/path_redirect.module on line 144.
    * user warning: Duplicate entry 'taxonomy/term/5' for key 2 query: INSERT INTO drupal_path_redirect (path, redirect, query, fragment, type) VALUES ('taxonomy/term/5', 'taxonomy/term/', '', '', '301') in /var/alternc/html/drupal/sites/all/modules/path_redirect/path_redirect.module on line 144.

Is it related to this current bug?

Note that I've made a bug report on the Path redirect tracker: #376024: user warning: Duplicate entry