Page MenuHomePhabricator

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

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}

Event Timeline

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.

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

@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 :)

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

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 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

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

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