Page MenuHomePhabricator

MissingTypeException when trying to set claim via the API
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.34.0-wmf.25

message
[XZtCTQpAIDUAAK1x2poAAADL] /w/api.php   Deserializers\Exceptions\MissingTypeException from line 89 of /vendor/wikibase/data-model-serialization/src/Deserializers/StatementDeserializer.php:

Impact

  • Rather small, happen 4 times in the last 24 hours

Notes

  • I seem to be unable to find the parameters of that API call. It would be helpful in tracing down this bug if we could see which claim they intended to set on which item.
  • This seems to be a new issue. It occurred first at 2019-10-07T13:49:01

Details

Request ID
XZtCTQpAIDUAAK1x2poAAADL
Request URL
/w/api.php
Stack Trace
exception.trace
#0 /extensions/Wikibase/repo/includes/Api/SetClaim.php(191): Wikibase\DataModel\Deserializers\StatementDeserializer->deserialize(array)
#1 /extensions/Wikibase/repo/includes/Api/SetClaim.php(109): Wikibase\Repo\Api\SetClaim->getStatementFromParams(array)
#2 /includes/api/ApiMain.php(1598): Wikibase\Repo\Api\SetClaim->execute()
#3 /includes/api/ApiMain.php(537): ApiMain->executeAction()
#4 /includes/api/ApiMain.php(508): ApiMain->executeActionWithErrorHandling()
#5 /api.php(87): ApiMain->execute()
#6 /srv/mediawiki/w/api.php(3): require(string)
#7 {main}

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Michael renamed this task from [XZtCTQpAIDUAAK1x2poAAADL] /w/api.php Deserializers\Exceptions\MissingTypeException from line 89 of /vendor/wikibase/data-model-serialization/src/Deserializers/StatementDeserializer.php: to Exception when trying to set claim via the API.Oct 7 2019, 3:17 PM

Hm, this exception is thrown in the case of:

if ( !is_array( $serialization ) || !array_key_exists( 'type', $serialization ) ) {
    throw new MissingTypeException();
}

But I would assume calls to deserialize() should be guarded at some point by isSerializerFor():

public function isDeserializerFor( $serialization ) {
    return is_array( $serialization )
        && array_key_exists( 'type', $serialization )
        && $this->isValidStatementType( $serialization['type'] );
}

So I’m not sure what’s happening here.

But anyways – I proposed removing the 'type' altogether in T230117: Remove type: statement from JSON serialization of statements, so that would presumably also resolve whatever this issue is.

Lucas_Werkmeister_WMDE renamed this task from Exception when trying to set claim via the API to MissingTypeException when trying to set claim via the API.Oct 8 2019, 11:57 AM

Since it's 4 times in 24 hours, I don't think it's needed to go directly to iteration board, but definitely should be addressed. Campsite for now is enough.

Addshore moved this task from Incoming to Needs Work on the Wikidata-Campsite board.
Lucas_Werkmeister_WMDE claimed this task.

I still don’t know what happened one year ago, but there are no occurrences of this in Logstash anymore, so we can’t really look further into it even if we wanted to. Let’s close this and open a new task if it ever happens again, I suppose.