Page MenuHomePhabricator

Unhandled AphrontDuplicateKeyQueryException when duplicate hashtags are assigned to a project
Closed, DuplicatePublic

Description

These duplicate slugs are sometimes guarded against, but can still happen in a few cases:

  • when creating a project, and adding a secondary hashtag that will collide with the derived primary hashtag.
  • when editing a project, and adding a secondary hashtag twice (but not if the project already had that hashtag before editing).

Error log:

#1062: Duplicate entry 'testslug' for key 'key_slug' at [AphrontBaseMySQLDatabaseConnection.php:299]

#1062: Duplicate entry 'testslug' for key 'key_slug'
Stack trace:
AphrontBaseMySQLDatabaseConnection::throwQueryCodeException called at [/data/libphutil/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:275]
AphrontBaseMySQLDatabaseConnection::throwQueryException called at [/data/libphutil/src/aphront/storage/connection/mysql/AphrontBaseMySQLDatabaseConnection.php:181]
AphrontBaseMySQLDatabaseConnection::executeRawQuery called at [/data/libphutil/src/xsprintf/queryfx.php:6]
queryfx
call_user_func_array called at [/data/libphutil/src/aphront/storage/connection/AphrontDatabaseConnection.php:28]
AphrontDatabaseConnection::query called at [/data/phabricator/src/infrastructure/storage/lisk/LiskDAO.php:1261]
LiskDAO::insertRecordIntoDatabase called at [/data/phabricator/src/infrastructure/storage/lisk/LiskDAO.php:1106]
LiskDAO::insert called at [/data/phabricator/src/infrastructure/storage/lisk/LiskDAO.php:1075]
LiskDAO::save called at [/data/phabricator/src/applications/project/editor/PhabricatorProjectTransactionEditor.php:139]
PhabricatorProjectTransactionEditor::applyCustomExternalTransaction called at [/data/phabricator/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:529]
PhabricatorApplicationTransactionEditor::applyExternalEffects called at [/data/phabricator/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:872]
PhabricatorApplicationTransactionEditor::applyTransactions called at [/data/phabricator/src/applications/project/controller/PhabricatorProjectEditDetailsController.php:140]
PhabricatorProjectEditDetailsController::handleRequest called at [/data/phabricator/src/aphront/configuration/AphrontApplicationConfiguration.php:234]
phlog called at [/data/phabricator/src/aphront/configuration/AphrontDefaultApplicationConfiguration.php:230]
AphrontDefaultApplicationConfiguration::handleException called at [/data/phabricator/src/aphront/configuration/AphrontApplicationConfiguration.php:238]
AphrontApplicationConfiguration::processRequest called at [/data/phabricator/src/aphront/configuration/AphrontApplicationConfiguration.php:148]
AphrontApplicationConfiguration::runHTTPRequest called at [/data/phabricator/webroot/index.php:17]