Page MenuHomePhabricator

Internal error: Invalid or virtual namespace -1 given.
Closed, ResolvedPublic5 Story Points

Description

Steps to reproduce

  1. go to https://test.wikimedia.beta.wmflabs.org/wiki/Special:ImportFile
  2. enter https://commons.wikimedia.org/wiki/File:Constantin_Hansen,_Et_selskab_af_danske_kunstnere_i_Rom,_1837,_KMS3236,_SMK.jpg
  3. submit
  4. no changes to the file, just click import

Error message
Internal error
[Wrz0XApEE4AAAAYYHzQAAAAE] /wiki/Special:ImportFile MWException from line 121 of /srv/mediawiki/php-master/includes/page/WikiPage.php: Invalid or virtual namespace -1 given.

Backtrace:

#0 /srv/mediawiki/php-master/includes/context/RequestContext.php(231): WikiPage::factory(Title)
#1 /srv/mediawiki/php-master/includes/context/DerivativeContext.php(196): RequestContext->getWikiPage()
#2 /srv/mediawiki/php-master/extensions/SpamBlacklist/includes/SpamBlacklistHooks.php(31): DerivativeContext->getWikiPage()
#3 /srv/mediawiki/php-master/includes/Hooks.php(177): SpamBlacklistHooks::filterMergedContent(DerivativeContext, WikitextContent, Status, NULL, User, boolean)
#4 /srv/mediawiki/php-master/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#5 /srv/mediawiki/php-master/extensions/FileImporter/src/Services/TextRevisionValidator.php(59): Hooks::run(string, array)
#6 /srv/mediawiki/php-master/extensions/FileImporter/src/Services/Importer.php(265): FileImporter\Services\TextRevisionValidator->validate(Title, User, WikitextContent, NULL, boolean)
#7 /srv/mediawiki/php-master/extensions/FileImporter/src/Services/Importer.php(140): FileImporter\Services\Importer->validateFileInfoText(User, FileImporter\Data\ImportPlan)
#8 /srv/mediawiki/php-master/extensions/FileImporter/src/Services/Importer.php(103): FileImporter\Services\Importer->importInternal(User, FileImporter\Data\ImportPlan)
#9 /srv/mediawiki/php-master/extensions/FileImporter/src/SpecialImportFile.php(283): FileImporter\Services\Importer->import(User, FileImporter\Data\ImportPlan)
#10 /srv/mediawiki/php-master/extensions/FileImporter/src/SpecialImportFile.php(177): FileImporter\SpecialImportFile->doImport(FileImporter\Data\ImportPlan)
#11 /srv/mediawiki/php-master/includes/specialpage/SpecialPage.php(522): FileImporter\SpecialImportFile->execute(NULL)
#12 /srv/mediawiki/php-master/includes/specialpage/SpecialPageFactory.php(568): SpecialPage->run(NULL)
#13 /srv/mediawiki/php-master/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#14 /srv/mediawiki/php-master/includes/MediaWiki.php(861): MediaWiki->performRequest()
#15 /srv/mediawiki/php-master/includes/MediaWiki.php(524): MediaWiki->main()
#16 /srv/mediawiki/php-master/index.php(42): MediaWiki->run()
#17 /srv/mediawiki/w/index.php(3): include(string)
#18 {main}

Event Timeline

Restricted Application added a project: TCB-Team. · View Herald TranscriptMar 29 2018, 2:16 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
WMDE-Fisch set the point value for this task to 5.

Change 423743 had a related patch set uploaded (by WMDE-Fisch; owner: WMDE-Fisch):
[mediawiki/extensions/FileImporter@master] Add missing WikiPage object to edit hook context

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

WMDE-Fisch moved this task from Sprint Backlog to Review on the WMDE-QWERTY-Sprint-2018-04-03 board.

The error showed only in combination with the SpamBlacklist extension. It uses the WikiPage object from the Context given to the Hook triggering the extension. I build that context in the FileImporter and used a variant where it seems that object could not be build properly. This is fixed in the patch.

And for the record: The Hook that we trigger for the AbuseFilter also triggers the SpamBlacklist extension. So we can check this as being consider in our import process.

Change 424324 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/FileImporter@master] Document validators to throw ValidationException

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

Change 423743 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Add missing WikiPage object to edit hook context

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

One note when testing: The above image does not work now since I imported it already while testing, so you have to get another one. :-)

See https://test.wikimedia.beta.wmflabs.org/w/index.php?title=File:Constantin_Hansen,_Et_selskab_af_danske_kunstnere_i_Rom,_1837,_KMS3236,_SMK.jpg&action=history

Change 424324 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Document validators to throw ValidationException

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

Apart from that being a different error ... it worked for me :-/

Import succeeded
"https://commons.wikimedia.org/wiki/File:Sinfonía_de_las_Piedras,_valle_de_Garni,_Armenia,_2016-10-02,_DD_33.jpg" has been imported to "File:Sinfonía de las Piedras, valle de Garni, Armenia, 2016-10-02, DD 33.jpg"

Also the ticket's error was part of the validation step. This error came from the commit operation that follows. I will create a task to investigate.

JStrodt_WMDE closed this task as Resolved.Apr 12 2018, 11:49 AM

Tested it with three different files from Commons, edited title and file info – and it worked! Thanks for fixing this bug.