Page MenuHomePhabricator

Not Wikilambda seems to be cyclically broken
Closed, ResolvedPublic


The Not Wikilambda test wiki has a few issues at the moment.

Trying to view any existing ZObject yields an error:

[be242de537c2824315e9fa88] /wiki/ZObject:Z1 Error: Call to a member function getLabel() on null


from /data/project/notwikilambda/public_html/w/extensions/WikiLambda/includes/ZObjectContent.php(302)
#0 /data/project/notwikilambda/public_html/w/includes/content/AbstractContent.php(591): MediaWiki\Extension\WikiLambda\ZObjectContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#1 /data/project/notwikilambda/public_html/w/includes/Revision/RenderedRevision.php(263): AbstractContent->getParserOutput(Title, integer, ParserOptions, boolean)
#2 /data/project/notwikilambda/public_html/w/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(MediaWiki\Extension\WikiLambda\ZObjectContent, boolean)
#3 /data/project/notwikilambda/public_html/w/includes/Revision/RevisionRenderer.php(217): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)

When trying to create a new object, the list of available languages for the label is empty:

type: Persistent Object; label: Multilingual text, with a dropdown, but the only option is a disabled “Add language:”, no other entries

When trying to create a new language object, there is a strange error message:

⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽

type: Persistent object, value: Natural language (Z60), code: de, label: (blank), Summary: create German; below, JSON for the object to be created, and then the quoted error message

I suspect that these are all related to the migration from language codes to languages (T279114), though this is just a guess: maybe the existing objects weren’t properly converted, which is why they can’t be viewed now, and because there are no Z60 instances yet, there are no languages available for labels. I’m not sure about that last error, though, why it’s not possible to create new language instances. (Note that the error message mentions a key Z11K1 and a language code en, neither of which actually occur in the request payload.)

Event Timeline

If I read Change language codes to ZLanguage (Z60) Zids correctly, then the wiki actually isn’t updated automatically at all, so I’ll see if running those maintenance scripts manually helps. (After taking a backup, of course.)

Mentioned in SAL (#wikimedia-cloud) [2021-06-05T11:36:07Z] <wm-bot> <lucaswerkmeister> made wiki read-only for maintenance (T284368)

Mentioned in SAL (#wikimedia-cloud) [2021-06-05T11:53:06Z] <wm-bot> <lucaswerkmeister> tried to run extensions/WikiLambda/development/updateLanguageCodes.php, most objects failed with the same “value en for Z11K1 … invalid” error as quoted in T284368

Okay, updateLanguageCodes.php didn’t help very much:

tools.notwikilambda@interactive:~$ time php public_html/w/extensions/WikiLambda/development/updateLanguageCodes.php
> Z1: UPDATE FAILED                                                 
⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽
> Z10: UPDATE FAILED                                                
⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽
> Z100: UPDATE FAILED                                               
⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽
> Z10000: UPDATE FAILED                                           
⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽
> Z10001: UPDATE FAILED                                             
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
> Z10004: UPDATE FAILED                  
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽                                         
> Z10005: DONE                         
> Z10006: UPDATE FAILED                                                                                                                                                                                                  
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
> Z10010: DONE
> Z10011: DONE
> Z10012: DONE
⧼Value 'gmy' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽

Though a handful of objects can now be viewed without error – the ones without labels, apparently:

No label defined in this language or accepted fallbacks (Z10005)

For all I know, these could’ve worked even before running the maintenance script – I don’t think I tried to open any such objects before creating this task.

I’ll try running the other script added in that commit, maintenance/reloadBuiltinData.php, before restoring the backup.

Mentioned in SAL (#wikimedia-cloud) [2021-06-05T12:11:55Z] <wm-bot> <lucaswerkmeister> ran extensions/WikiLambda/maintenance/reloadBuiltinData.php, most objects seemed to work, only a few errors (T284368)

Well, it printed less errors, at least:

tools.notwikilambda@interactive:~$ time php public_html/w/extensions/WikiLambda/maintenance/reloadBuiltinData.php
Updated Z1
Updated Z2
Updated Z3
Problem updating Z4
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
Problem updating Z5
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
Updated Z6
Updated Z7
Updated Z8
Updated Z9
Updated Z10
Updated Z11
Updated Z12
Updated Z13
Problem updating Z14
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
Problem updating Z16
⧼⧼Value 'en' for 'Z11K1' of type 'Reference(Language)' is invalid.⧽⧽
Updated Z17
Updated Z18
Updated Z20

Well, many previously broken objects can now be viewed, though the labels look strange:

Object (Z1); nested in the object are a key with label: Multilingual text – (): type, and at the end label: Multilingual text – (): Object

Some objects that printed an error in the maintenance script still don’t work (same error as before), such as Z4 and Z14. For others, like Z1477, Z1762 or Z1852, MediaWiki claims they don’t exist at all?

I think I’ll leave the wiki like this, at least for now, rather than restoring the backup. This effectively wiped the contributions to the builtin objects (mainly translations to the labels, I assume), but that was always a risk with this wiki, and having mostly working builtin objects seems to me like a better state than a wiki with intact contributions that can’t be viewed or used.

That said, I suspect this “Value '…' for 'Z11K1' of type 'Reference(Language)' is invalid.” is a bug in WikiLambda which should be fixed. (Also, at some point this English string apparently gets misinterpreted as a message key, sometimes even twice, hence the ⧼⧽ and ⧼⧼⧽⧽ around it.)

Mentioned in SAL (#wikimedia-cloud) [2021-06-05T12:23:33Z] <wm-bot> <lucaswerkmeister> wiki no longer read-only (T284368)

Label languages are available now, by the way:

Create a new ZObject; the “add language” dropdown now has many entries, starting with Abaza (Z1196), Abkhazian (Z1421), Achinese (Z1562), Adangme (Z1317), etc.

It turns out that the “broken” objects can be fixed by converting their labels to the ZID form – see the history of for an example.

It turns out that the “broken” objects can be fixed by converting their labels to the ZID form – see the history of for an example.

But, trying to load a diff in that history for the most recent edit fails

[f70201ed004b02a392ec19a5] /w/index.php?title=ZObject%3AZ10001&type=revision&diff=2249&oldid=2248 Wikimedia\Assert\ParameterTypeException: Bad value for parameter $oldContent: must be a TextContent|null


from /data/project/notwikilambda/public_html/w/vendor/wikimedia/assert/src/Assert.php(105)
#0 /data/project/notwikilambda/public_html/w/includes/diff/SlotDiffRenderer.php(89): Wikimedia\Assert\Assert::parameterType(array, MediaWiki\Extension\WikiLambda\ZObjectContent, string)
#1 /data/project/notwikilambda/public_html/w/includes/diff/TextSlotDiffRenderer.php(125): SlotDiffRenderer->normalizeContents(MediaWiki\Extension\WikiLambda\ZObjectContent, MediaWiki\Extension\WikiLambda\ZObjectContent, string)
#2 /data/project/notwikilambda/public_html/w/includes/diff/DifferenceEngine.php(1216): TextSlotDiffRenderer->getDiff(MediaWiki\Extension\WikiLambda\ZObjectContent, MediaWiki\Extension\WikiLambda\ZObjectContent)
#3 /data/project/notwikilambda/public_html/w/includes/diff/DifferenceEngine.php(1124): DifferenceEngine->getDiffBody()
#4 /data/project/notwikilambda/public_html/w/includes/diff/DifferenceEngine.php(1086): DifferenceEngine->getDiff(string, string, string)
#5 /data/project/notwikilambda/public_html/w/includes/diff/DifferenceEngine.php(852): DifferenceEngine->showDiff(string, string, string)
#6 /data/project/notwikilambda/public_html/w/includes/page/Article.php(931): DifferenceEngine->showDiffPage(boolean)
#7 /data/project/notwikilambda/public_html/w/includes/page/Article.php(512): Article->showDiffPage()
#8 /data/project/notwikilambda/public_html/w/includes/actions/ViewAction.php(74): Article->view()
#9 /data/project/notwikilambda/public_html/w/includes/MediaWiki.php(536): ViewAction->show()
#10 /data/project/notwikilambda/public_html/w/includes/MediaWiki.php(320): MediaWiki->performAction(Article, Title)
#11 /data/project/notwikilambda/public_html/w/includes/MediaWiki.php(917): MediaWiki->performRequest()
#12 /data/project/notwikilambda/public_html/w/includes/MediaWiki.php(551): MediaWiki->main()
#13 /data/project/notwikilambda/public_html/w/index.php(53): MediaWiki->run()
#14 /data/project/notwikilambda/public_html/w/index.php(46): wfIndexMain()
#15 {main}

Update: this appears to happen for any history of a ZObject, not just that specific one

I threw together some JavaScript to fix the monolingual texts:

async function pageContent(api, title) {
  const response = await api.get({
    action: 'query',
    titles: [title],
    prop: ['revisions'],
    rvprop: ['content'],
    rvslots: ['main'],
    formatversion: 2,
  return response.query.pages[0].revisions[0].slots.main.content;

async function loadLanguageCodeToZidMap(api) {
  const lua = await pageContent(api, 'Module:ZObject/data');
  const json = (await{
    action: 'scribunto-console',
    title: 'Module:ZObject/data',
    content: lua,
    question: '=mw.text.jsonEncode(p.language_code_to_zid)',
  return JSON.parse(json);

async function fixT284368(api, zid) {
  const title = `ZObject:${zid}`;
  const [zobjectContent, languageCodeToZidMap] = await Promise.all([
    pageContent(api, title),
  const zobject = JSON.parse(zobjectContent, (key, value) => {
    if (value && value.Z1K1 === 'Z11') {
      if (value.Z11K1 in languageCodeToZidMap) {
        value.Z11K1 = languageCodeToZidMap[value.Z11K1];
    return value;
    action: 'wikilambda_edit',
    zobject: JSON.stringify(zobject),
    summary: 'change label language codes to ZIDs ([[phabricator:T284368|T284368]])',
    assert: 'user',

fixT284368(new mw.Api(), mw.config.get('wgTitle')).catch(console.error);

Worked successfully on Z4, so I guess I’ll now run that on all the other failing pages as well.

Alright, fixing Z5 doesn’t work, because apparently the content of that page specifies the ID (Z2K1) as Z4 rather than Z5, which wikilamdba_edit then (rightfully, I suppose) complains about when trying to save the fixed revision.

Fixing other objects seems to have worked (though I didn’t systematically go through all of them – I skipped the four-digit IDs, assuming they’re all language objects that work anyways).

Okay, Z5 is now fixed as well (I added a line zobject.Z2K1 = 'Z5'; before saving the edit). I guess that ID was just a mistake in the initial data (which was then fixed in Iee44178630).

I guess I’ll close this task now, the “cyclic” brokenness seems to be resolved.