Page MenuHomePhabricator

ConstraintParameterException on every constraint with exceptions
Closed, ResolvedPublic

Description

Special:ConstraintReport on an item with a statement with a constraint that has exceptions (e. g. Q3033 – I estimate this affects the majority of items with more than a handful of statements) shows this error:

Fatal exception of type "WikibaseQuality\ConstraintReport\ConstraintCheck\Helper\ConstraintParameterException"

Similarly, a wbcheckconstraints API request on such an item (such requests are, for example, performed by the checkConstraints gadget each time an item is visited) shows this error:

{

"code": "internal_api_error_WikibaseQuality\\ConstraintReport\\ConstraintCheck\\Helper\\ConstraintParameterException",
"info": "[WXDsswpAEDMAAE176mYAAAAS] Exception caught: The value for the parameter &quot;<span class=\"wbqc-role wbqc-role-constraint-parameter-property\">known_exception</span>&quot; must be an entity, not &quot;<span class=\"wbqc-role wbqc-role-constraint-parameter-value\">Q9712957\u200e</span>&quot;."

}

The reason for this is that DelegatingConstraintChecker::checkConstraintsForStatementOnEntity makes CostraintParameterParser parse the constraint exceptions (the items that a constraint doesn’t apply to), but doesn’t catch the ConstraintParameterExceptions that can occur when the exceptions contain malformed data. In the case of the second error message above, there seem to be some exception templates that containt Unicode left-to-right marks (U+200E).

Event Timeline

UBN! because it’s happening right now on Wikidata for most constraint checks. Note that T169647: Enable constraint statements on Wikidata will hopefully mitigate this, since the exceptions in statements are hopefully not broken (⇒ no ConstraintParameterException).

Change 366600 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Catch exceptions from parseExceptionParameter

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

Change 366602 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Add test for bad exception parameter

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

Change 366600 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Catch exceptions from parseExceptionParameter

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

Change 366602 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Add test for bad exception parameter

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

Change 366748 had a related patch set uploaded (by Aude; owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@wmf/1.30.0-wmf.10] Catch exceptions from parseExceptionParameter

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

Change 366748 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@wmf/1.30.0-wmf.10] Catch exceptions from parseExceptionParameter

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

Change 366754 had a related patch set uploaded (by Aude; owner: Aude):
[mediawiki/extensions/Wikidata@wmf/1.30.0-wmf.10] Update Wikidata - fix uncaught exception in constraints

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

Change 366754 merged by jenkins-bot:
[mediawiki/extensions/Wikidata@wmf/1.30.0-wmf.10] Update Wikidata - fix uncaught exception in constraints

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

Fix is deployed and special page and API work again – thanks a lot aude and Reedy!