Page MenuHomePhabricator

[{reqId}] {exception_url} Wikimedia\Rdbms\DBQueryError: Error 1062: Duplicate entry 'X-X-X' for key 'PRIMARY' Function: MediaWiki\CheckUser\Services\UserAgentClientHintsManager::insertMappingRows Query: INSERT INTO `cu_useragent_clienthints_map where query doesn't include duplicated rows
Closed, DuplicatePublicPRODUCTION ERROR

Description

Error
message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1062: Duplicate entry 'X-X-X' for key 'PRIMARY'
Function: MediaWiki\CheckUser\Services\UserAgentClientHintsManager::insertMappingRows
Query: INSERT INTO `cu_useragent_clienthints_map
trace
from /srv/mediawiki/php-1.41.0-wmf.22/includes/libs/rdbms/database/Database.php(1236)
#0 /srv/mediawiki/php-1.41.0-wmf.22/includes/libs/rdbms/database/Database.php(1220): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /srv/mediawiki/php-1.41.0-wmf.22/includes/libs/rdbms/database/Database.php(1194): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /srv/mediawiki/php-1.41.0-wmf.22/includes/libs/rdbms/database/Database.php(679): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /srv/mediawiki/php-1.41.0-wmf.22/includes/libs/rdbms/database/Database.php(1509): Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#4 /srv/mediawiki/php-1.41.0-wmf.22/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->insert(string, array, string)
#5 /srv/mediawiki/php-1.41.0-wmf.22/includes/libs/rdbms/database/DBConnRef.php(402): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /srv/mediawiki/php-1.41.0-wmf.22/extensions/CheckUser/src/Services/UserAgentClientHintsManager.php(170): Wikimedia\Rdbms\DBConnRef->insert(string, array, string)
#7 /srv/mediawiki/php-1.41.0-wmf.22/extensions/CheckUser/src/Services/UserAgentClientHintsManager.php(105): MediaWiki\CheckUser\Services\UserAgentClientHintsManager->insertMappingRows(MediaWiki\CheckUser\ClientHints\ClientHintsData, integer, string, boolean)
#8 /srv/mediawiki/php-1.41.0-wmf.22/extensions/CheckUser/src/Api/Rest/Handler/UserAgentClientHintsHandler.php(94): MediaWiki\CheckUser\Services\UserAgentClientHintsManager->insertClientHintValues(MediaWiki\CheckUser\ClientHints\ClientHintsData, integer, string)
#9 /srv/mediawiki/php-1.41.0-wmf.22/includes/Rest/SimpleHandler.php(38): MediaWiki\CheckUser\Api\Rest\Handler\UserAgentClientHintsHandler->run(string, integer)
#10 /srv/mediawiki/php-1.41.0-wmf.22/includes/Rest/Router.php(517): MediaWiki\Rest\SimpleHandler->execute()
#11 /srv/mediawiki/php-1.41.0-wmf.22/includes/Rest/Router.php(422): MediaWiki\Rest\Router->executeHandler(MediaWiki\CheckUser\Api\Rest\Handler\UserAgentClientHintsHandler)
#12 /srv/mediawiki/php-1.41.0-wmf.22/includes/Rest/EntryPoint.php(195): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#13 /srv/mediawiki/php-1.41.0-wmf.22/includes/Rest/EntryPoint.php(135): MediaWiki\Rest\EntryPoint->execute()
#14 /srv/mediawiki/php-1.41.0-wmf.22/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#15 /srv/mediawiki/w/rest.php(3): require(string)
#16 {main}
Impact
Notes

Similar error to T344787, but different fix will be needed. Also seems to be a slightly different cause. Based on an inspection of the query, the issue is that the row already exists in the DB. I suspect setting IGNORE on the query should fix the issue.