Page MenuHomePhabricator

Wikidata/extensions/Constraints: InvalidArgumentException:$itemId must be either ItemId or string
Closed, ResolvedPublicPRODUCTION ERROR

Description

Seems to have started with the rollout of 1.30.0-wmf.9 to group1, is fairly noisy in error logs currently

#0 /srv/mediawiki/php-1.30.0-wmf.9/extensions/Wikidata/extensions/Constraints/includes/ConstraintCheck/Checker/TargetRequiredClaimChecker.php(139): WikibaseQuality\ConstraintReport\ConstraintParameterRenderer->formatItemId(Wikibase\DataModel\Entity\PropertyId)
#1 /srv/mediawiki/php-1.30.0-wmf.9/extensions/Wikidata/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php(237): WikibaseQuality\ConstraintReport\ConstraintCheck\Checker\TargetRequiredClaimChecker->checkConstraint(Wikibase\DataModel\Statement\Statement, WikibaseQuality\ConstraintReport\Constraint, Wikibase\DataModel\Entity\Item)
#2 /srv/mediawiki/php-1.30.0-wmf.9/extensions/Wikidata/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php(216): WikibaseQuality\ConstraintReport\ConstraintCheck\DelegatingConstraintChecker->getCheckResultFor(Wikibase\DataModel\Statement\Statement, WikibaseQuality\ConstraintReport\Constraint, Wikibase\DataModel\Entity\Item)
#3 /srv/mediawiki/php-1.30.0-wmf.9/extensions/Wikidata/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php(181): WikibaseQuality\ConstraintReport\ConstraintCheck\DelegatingConstraintChecker->checkConstraintsForStatementOnEntity(array, Wikibase\DataModel\Entity\Item, Wikibase\DataModel\Statement\Statement)
#4 /srv/mediawiki/php-1.30.0-wmf.9/extensions/Wikidata/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php(147): WikibaseQuality\ConstraintReport\ConstraintCheck\DelegatingConstraintChecker->checkStatement(Wikibase\DataModel\Entity\Item, Wikibase\DataModel\Statement\Statement, NULL)
#5 /srv/mediawiki/php-1.30.0-wmf.9/extensions/Wikidata/extensions/Constraints/includes/ConstraintCheck/DelegatingConstraintChecker.php(104): WikibaseQuality\ConstraintReport\ConstraintCheck\DelegatingConstraintChecker->checkEveryStatement(Wikibase\DataModel\Entity\Item, NULL)
#6 /srv/mediawiki/php-1.30.0-wmf.9/extensions/Wikidata/extensions/Constraints/api/CheckConstraints.php(191): WikibaseQuality\ConstraintReport\ConstraintCheck\DelegatingConstraintChecker->checkAgainstConstraintsOnEntityId(Wikibase\DataModel\Entity\ItemId, NULL)
#7 /srv/mediawiki/php-1.30.0-wmf.9/extensions/Wikidata/extensions/Constraints/api/CheckConstraints.php(179): WikibaseQuality\ConstraintReport\Api\CheckConstraints->checkItems(array, NULL)
#8 /srv/mediawiki/php-1.30.0-wmf.9/includes/api/ApiMain.php(1583): WikibaseQuality\ConstraintReport\Api\CheckConstraints->execute()
#9 /srv/mediawiki/php-1.30.0-wmf.9/includes/api/ApiMain.php(546): ApiMain->executeAction()
#10 /srv/mediawiki/php-1.30.0-wmf.9/includes/api/ApiMain.php(517): ApiMain->executeActionWithErrorHandling()
#11 /srv/mediawiki/php-1.30.0-wmf.9/api.php(94): ApiMain->execute()
#12 /srv/mediawiki/w/api.php(3): include(string)
#13 {main}

Event Timeline

thcipriani triaged this task as Unbreak Now! priority.Jul 13 2017, 4:40 PM

UBN since I added as a train blocker.

Added as blocker as this appears to be a new log message with wmf.9.

thcipriani lowered the priority of this task from Unbreak Now! to Medium.Jul 13 2017, 6:54 PM

Removed as train blocker, seems to have been happening pre 1.30.0-wmf.9, sorry for the noise

This seems to be caused by TargetRequiredClaimChecker::checkConstraint passing PropertyId to ConstraintParameterRenderer::formatItemId where it only accepts ItemId. The problem here seems to be that data value is checked to be entity id, but entity id can be both property and item IDs.

Yeah, there are two “Target required claim” constraints on P​1647 (subproperty of), which has datatype property, but the code assumes its entity ID is an ItemId when formatting the violation message.

Change 365087 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Fix “Target required claim” error message

https://gerrit.wikimedia.org/r/365087

The above change should fix this problem and apply cleanly on top of the currently deployed code (which is badaf32221 if I’m not mistaken).

Change 365087 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Fix “Target required claim” error message

https://gerrit.wikimedia.org/r/365087

I can't find any instance of this error message in logstash anymore. Thank you for your work on this!

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM