Page MenuHomePhabricator

Fatal Error on Commons from Special:EntityData with n3 format (Argument to addEntityRedirect must be EntityId, null given)
Closed, ResolvedPublic

Description

Accessing pages like https://commons.wikimedia.org/wiki/Special:EntityData/M343610.n3 causes an fatal error. This apperently happens well over a 100 times per day, see Logstash.

PHP Fatal Error: Argument 1 passed to Wikibase\Rdf\RdfBuilder::addEntityRedirect() must be an instance of Wikibase\DataModel\Entity\EntityId, null given

#0 /srv/mediawiki/php-1.34.0-wmf.5/extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(268): NO_FUNCTION_GIVEN()
#1 /srv/mediawiki/php-1.34.0-wmf.5/extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(244): Wikibase\Repo\LinkedData\EntityDataSerializationService->addIncomingRedirects(Wikibase\MediaInfo\DataModel\MediaInfoId, NULL, array, Wikibase\Rdf\RdfBuilder)
#2 /srv/mediawiki/php-1.34.0-wmf.5/extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(182): Wikibase\Repo\LinkedData\EntityDataSerializationService->rdfSerialize(Wikibase\Lib\Store\EntityRevision, NULL, array, Wikibase\Rdf\RdfBuilder, NULL)
#3 /srv/mediawiki/php-1.34.0-wmf.5/extensions/Wikibase/repo/includes/LinkedData/EntityDataRequestHandler.php(516): Wikibase\Repo\LinkedData\EntityDataSerializationService->getSerializedData(string, Wikibase\Lib\Store\EntityRevision, NULL, array, NULL)
#4 /srv/mediawiki/php-1.34.0-wmf.5/extensions/Wikibase/repo/includes/LinkedData/EntityDataRequestHandler.php(261): Wikibase\Repo\LinkedData\EntityDataRequestHandler->showData(WebRequest, OutputPage, string, Wikibase\MediaInfo\DataModel\MediaInfoId, integer)
#5 /srv/mediawiki/php-1.34.0-wmf.5/extensions/Wikibase/repo/includes/Specials/SpecialEntityData.php(156): Wikibase\Repo\LinkedData\EntityDataRequestHandler->handleRequest(string, WebRequest, OutputPage)
#6 /srv/mediawiki/php-1.34.0-wmf.5/includes/specialpage/SpecialPage.php(570): Wikibase\Repo\Specials\SpecialEntityData->execute(string)
#7 /srv/mediawiki/php-1.34.0-wmf.5/includes/specialpage/SpecialPageFactory.php(575): SpecialPage->run(string)
#8 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#9 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(865): MediaWiki->performRequest()
#10 /srv/mediawiki/php-1.34.0-wmf.5/includes/MediaWiki.php(515): MediaWiki->main()
#11 /srv/mediawiki/php-1.34.0-wmf.5/index.php(42): MediaWiki->run()
#12 /srv/mediawiki/w/index.php(3): include(string)
#13 {main}

Details

Related Gerrit Patches:

Event Timeline

Michael created this task.May 21 2019, 2:17 PM
Restricted Application added a project: Multimedia. · View Herald TranscriptMay 21 2019, 2:17 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Michael triaged this task as High priority.May 21 2019, 2:17 PM
Michael moved this task from 🗃️ Incoming to 👁️ watching on the User-Michael board.
Restricted Application added a project: Wikidata. · View Herald TranscriptMay 21 2019, 5:33 PM

@Michael - is this something WMDE is looking into or something we need to sort out?

Michael added a comment.EditedMay 22 2019, 8:45 AM

@Michael - is this something WMDE is looking into or something we need to sort out?

This issue seems to only affect commons/WikibaseMediaInfo. I can get https://www.wikidata.org/wiki/Special:EntityData/Q988695.n3 without errors. We are currently not looking into this, but please let us know if you need anything from us :)

This comment was removed by Aklapper.

I suspect there's some bug in format matching - .ttl, .nt, .rdf etc produce proper error message (since RDF export for MI entities is not enabled yet) but .n3 (which is supposed to be same as .nt) does not.

Krinkle renamed this task from Fatal Error on commons wiki from Special:EntityData with n3 format to Fatal Error on Commons from Special:EntityData with n3 format (Argument to addEntityRedirect must be EntityId, null given).May 26 2019, 5:34 PM
Smalyshev moved this task from Backlog to Next on the User-Smalyshev board.May 28 2019, 6:34 AM

Ok, it's clear what is going on:

		if ( $this->rdfOutputRequested( $format ) && in_array( $entityId->getEntityType(), $this->entityTypesWithoutRdfOutput ) ) {
			throw new HttpError( 406, $output->msg( 'wikibase-entitydata-rdf-not-available', $entityId->getEntityType() ) );
		}

	private function rdfOutputRequested( $format ) {
		return $format === 'rdf' || $format === 'ttl' || $format === 'nt';
	}

"n3" is an RDF format but is not treated as such.

Smalyshev moved this task from Next to In review on the User-Smalyshev board.May 30 2019, 11:43 PM
Smalyshev moved this task from In review to Doing on the User-Smalyshev board.

Change 513537 had a related patch set uploaded (by Smalyshev; owner: Smalyshev):
[mediawiki/extensions/Wikibase@master] Use actual RDF factory data to decide if the format is RDF or not

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

Smalyshev moved this task from Doing to In review on the User-Smalyshev board.May 31 2019, 12:23 AM

Change 513537 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Use actual RDF factory data to decide if the format is RDF or not

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

Smalyshev moved this task from In review to Done on the User-Smalyshev board.Jun 1 2019, 2:53 AM
Smalyshev closed this task as Resolved.Jun 5 2019, 6:51 PM
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:07 PM
Restricted Application added a project: Structured-Data-Backlog. · View Herald TranscriptAug 28 2019, 11:07 PM