Wikipedia talk:Wikidata

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Wikidata  
WikiProject icon This page is within the scope of WikiProject Wikidata, a collaborative effort to improve Wikipedia's integration with Wikidata. If you would like to participate, please visit the project page.

Wikidata script errors[edit]

Screenshot of Minneapolis showing errors

I keep seeing errors like this:

Lua error in mw.wikibase.entity.lua at line 34: The entity data must be a table obtained via mw.wikibase.getEntityObject.

That was at the end of Jews, in place of the Authority Control template. But there was and is nothing wrong with the page; purging the page clears it. And there is no recent change that could of caused it, that I can see. And this happens again and again, at a few places in articles, usually at the end or in an infobox. I suspect it is happening far more times than I am seeing, as the category Category:Pages with script errors is having dozens mainspace articles added to it on a daily basis, the majority of which have no visible error. I suspect they are being added to the category by errors like the above, but someone else is editing the article or purging it to remove the error before I see it.

So they are trivial to fix if you know how, but until fixed are glaring errors appearing in prominent places in articles, in place of some other piece of content such as the Authority Control template or the infobox map. It seems to be a consequence of data being moved to Wikidata and accessed there, which has been happening at an accelerating rate recently. Certainly these errors are very recent, I have only been noticing them for a few weeks. But they seem to be getting more frequent, and appearing more often in more important articles.--JohnBlackburnewordsdeeds 16:53, 22 June 2017 (UTC)

I have been seeing weirdness in the list of articles with script errors for a week. I have not seen the error above, but I have noticed articles in the error category that do not show the hidden category on the page, and where the article and "related changes" show no activity in the last six months. Searching the html source of the article likewise does not show any error (it sometimes does, although when that happens the category is on the article). I was thinking of asking at WP:VPT but I've been busy and it's hard to pin down. I often purge the long list in an effort to find any pages that really have problems. Johnuniq (talk) 23:28, 22 June 2017 (UTC)
I saw one more of these errors today. In Magnus Carlsen. It disappeared before I purged it though, due to an edit elsewhere in the article.
Oddly I saw two errors. One identical to the above one, where the Authority Control should be. And another where the {{Official Website}} was. A different error but they were both Wikidata related. Seemingly the templates and the relevant entries on Wikidata were fine, but both templates failed in getting data from Wikidata. I have seen this before, a couple of times, where two templates are affected, though normally it’s just one. Seems it’s a general failure to access Wikidata, rather than a failure in one item or template.--JohnBlackburnewordsdeeds 10:48, 23 June 2017 (UTC)

Another example with 2 errors in prominent positions, in an article not edited for over a week. I will not fix this by purging; though it could go away any time it’s a low priority page so the errors might stick around. The page is Miami, Oklahoma.

Coordinates:Lua error in mw.wikibase.entity.lua at line 34: The entity data must be a table obtained via mw.wikibase.getEntityObject.


Wikivoyage has a travel guide for [[Wikivoyage:Miami (Oklahoma)#Lua error in mw.wikibase.entity.lua at line 34: The entity data must be a table obtained via mw.wikibase.getEntityObject.|Miami, Oklahoma]].

The first is an error at line 482 of Module:Coordinates, the second is line 1004 of Module:Wikidata, with the lines both looking like this:

local entity = mw.wikibase.getEntityObject()

It seems to very intermittently fail inside that function, for all of its uses on that page. That function is described here: mw:Extension:Wikibase Client/Lua. but there’s no indication why it might occasionally fail. The problem is, when it does the errors simply stay in the page. A search for "mw.wikibase.getEntityObject" across WP pages turns up more affected pages, all fixed but with the search engine having cached a broken version.--JohnBlackburnewordsdeeds 00:16, 24 June 2017 (UTC)

I see it, and have stored the wikitext and HTML. Obviously Wikidata can fail intermittently, and some debug code to capture what is going on might need to be added to both modules. I'll have a deeper look when I get a chance. It might be useful to raise the issue somewhere at Wikidata, perhaps d:Wikidata:Project chat or d:Wikidata:Contact the development team. Johnuniq (talk) 02:17, 24 June 2017 (UTC)

My superficial reading of mw.wikibase.entity.lua and mw.wikibase.lua suggests that these events occurred:

  • As described by JohnBlackburne above, a module executes
    local entity = mw.wikibase.getEntityObject()
    and Scribunto tries to get the entity for the current page.
  • Function getEntityIdForCurrentPage gets the result from php.getEntityId.
  • The result is then checked, and the error message occurs because the following check fails:
    type( data.schemaVersion ) ~= 'number'
    where data is the result (the entity object) from php.
  • The probable issue is that data does not contains schemaVersion, or it is present but is a string representation of a number. Could a particular server be running old code?

It looks as if there is nothing a module could do to avoid the issue—trapping the error and bailing out seems unhelpful because that approach would suggest that every call to a mw function might crash and so would need an error handler. At any rate, this is above my pay grade so I am calling Anomie for help. Johnuniq (talk) 05:22, 24 June 2017 (UTC)

I tried JohnBlackburne's suggestion of doing an enwiki search for mw.wikibase.getEntityObject. It showed 24 hits at enwiki and one under sister projects, namely s:Kilvert, Francis (DNB00) which was last edited in January 2014, although the HTML source includes "Cached time: 20170620104652". The cache for Miami, Oklahoma has been updated and it no longer shows the error. Of the 24 search hits, only these four pages show the error: Bosilegrad + John Calvin + Oechse + Stephen F. Austin State University. The error in John Calvin is due to its use of {{Internet Archive author}} which calls Module:Internet Archive. In the others, the problem is {{Coord}}. Johnuniq (talk) 10:42, 24 June 2017 (UTC)
For completeness when first looking at this most of the errors seemed to be in {{Authority control}}, and its module calls mw.wikibase.getEntityObject() every time it is used on line 346. This explains what was initially confusing about these errors: they can occur in almost any article as templates using Wikidata are now common and widespread. Even if they don’t actually need to pull data from Wikidata they seem to be checking whether it exists. I am hardly seeing the error in articles any more, I suspect as other editors are noticing them first and are purging the articles.--JohnBlackburnewordsdeeds 18:52, 24 June 2017 (UTC)
@Johnuniq: Your best bet would be to file a task in Phabricator with as much information as you have available. Anomie 12:06, 24 June 2017 (UTC)
Thanks but it was easier for me to post at d:Wikidata:Contact the development team#Lua error in mw.wikibase.entity.lua. Johnuniq (talk) 06:01, 25 June 2017 (UTC)
One more example, the first time I’ve seen three errors on a page I think, at Minneapolis, so I took a screenshot for reference, though it does not show anything new.--JohnBlackburnewordsdeeds 14:03, 25 June 2017 (UTC)

@JohnBlackburne: After a spectacular failure to get any interest at Wikidata, I reported the issue at T170039. Johnuniq (talk) 09:05, 8 July 2017 (UTC)

 Comment: este tema también se estátratando en El arículo que se reportó en la sección técnica del café de ya no muestra el error pero este otro sí. Perdón por escribir en español. --Jcfidy (talk) 09:46, 30 July 2017 (UTC)

"This topic is also being discussed in the Spanish Wikipedia. The article that was reported in the technical section of es:Wikipedia:Café (Village Pump) no longer shows the error but this one (Jerusalem) does." no need to apologise! --RexxS (talk) 14:27, 30 July 2017 (UTC)
I purged es:Jerusalén, error gone. This is all that's usually needed. -- ferret (talk) 15:26, 30 July 2017 (UTC)
Other in es.wikipedia. --Jcfidy (talk) 16:11, 30 July 2017 (UTC)
Done. To purge, just save the page with no changes. -- ferret (talk) 16:36, 30 July 2017 (UTC)

The issue has been reported at Phabricator—see T170039. There are some other related problems (see (VPT) and the underlying cause is not clear. However it is being pursued by developers and will be fixed in due course. There is nothing we editors can do other than purge problem pages. Johnuniq (talk) 22:30, 30 July 2017 (UTC)

  • For anyone watching this page, it appears the problem has been fixed per an announcement at the above phab link. Full details of the cause are not entirely clear, but signs so far are that the fix has worked. Johnuniq (talk) 05:37, 24 August 2017 (UTC)
    I've seen the error and purged a page for this issue in the last 2-3 days, but can't remember exactly when unfortunately. Will keep an eye out of course. -- ferret (talk) 10:19, 24 August 2017 (UTC)
    Note it doesn't matter when you've purged a page for the issue, what matters is when the error was generated in the first place. Anomie 14:03, 24 August 2017 (UTC)
    The cause was that certain errors in Lua would result in the data structure recursion detector (used when sending data from PHP to Lua) failing to remove memory pointers from a thread-global set of memory pointers encountered during the current conversion. Later recursion checks that happened to reuse one of those memory pointers would incorrectly report a recursion, which resulted in the data item not being correctly passed from PHP to Lua. Lua would then see a nil value rather than the expected table. Anomie 14:03, 24 August 2017 (UTC)
    @Anomie: Is that documented in Phabricator? I know that, on the main task for this issue, as recently as this week, someone was claiming we didn't know what the root cause of the issue was. It would be good to make sure the technical stuff gets on there. --Izno (talk) 17:39, 24 August 2017 (UTC)
    It's described in T166348, and in gerrit:362301. Note that, while it was suspected since July 20 or earlier that T170039 and T166348 shared the same cause, the real confirmation was the fact that T170039 stopped happening after gerrit:362301 was finally deployed. Anomie 18:17, 24 August 2017 (UTC)
    @Anomie: Thanks for the interesting explanation, and thanks for fixing the problem! Johnuniq (talk) 23:06, 24 August 2017 (UTC)
    My thanks too; well outside my own areas of experience but interesting and good to know that it has been fixed, not just patched to suppress it. Now we can go back to using the category normally.--JohnBlackburnewordsdeeds 23:58, 24 August 2017 (UTC)


How to create a list using data from wikidata? -- Pankaj Jain Capankajsmilyo (talk · contribs · count) 06:37, 2 November 2017 (UTC)

@Capankajsmilyo: Review the documentation for {{Wikidata list}}. --Izno (talk) 14:16, 2 November 2017 (UTC)
@Izno: thanks. I have created User:Capankajsmilyo/List of Jains, and now I want to compare it with List of Jains. Can you please help? -- Pankaj Jain Capankajsmilyo (talk · contribs · count) 15:34, 2 November 2017 (UTC)

CS1 parameter to wikify journal name when given ISSN[edit]

I requested that our main citation template (CS1) have an optional parameter that, when an ISSN is provided, would use Wikidata to provide the publication name wikilink instead of having to set it manually. I considered it a simple, textbook case for something Wikidata is suited to automate. Discuss at Help talk:Citation Style 1#Wikify journal based on ISSN czar 23:04, 12 November 2017 (UTC)