Page MenuHomePhabricator

Missing "continue" element for categories prop when clshow set
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

What happens?:

  • No continue element is returned, even though categories have not been fully populated for all articles. Example response (Pastebin).
  • I also note that that response contains 374 categories, even though cllimit=max in the querystring and "limits: { categories: 500 }" is returned in the response.

What should have happened instead?:

  • A continue element should be returned, allowing the user to make follow-up requests to obtain all categories for all requested articles. This was the observed behaviour of my nightly API requests until approximately 27 February 2026.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
Current Wikipedia, 1.46.0-wmf.18

Other information (browser name/version, screenshots, etc.):
Associated question on Meta Wiki - a user advised to create a Phabricator issue
Potentially linked issue: T405812: Migrate categorylinks to virtual domain
Suspect code change

Event Timeline

If I don't set clshow=!hidden, then a continue element is returned as expected. The same example query, with no clshow parameter.

Matthew renamed this task from Action API: missing "continue" element for categories prop to Missing "continue" element for categories prop when clshow set.Mar 11 2026, 5:52 PM
HCoplin-WMF subscribed.

Moving to MWI bugs & chores. Categories as a whole is currently unowned, but we can take a look to see if there is something more systemic happening in the query action as a whole.

It seems likely based on the effect and timing that the issue is associated with this change: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1241311 (@Zabe) which changed how categories are filtered.

The impact is:

  • Action API requests with clshow=!hidden or clshow=hidden that correctly returned a continue element until ~27 February 2026 now fail to do so (i.e. this is a regression)
  • the API silently fails to return all categories for a valid request
  • as there is no continue element, the user has no way of knowing that they have not received all requested data, nor any way of retrieving said data without altering their requests

The bug here is that in the old query design the filtering happened while querying, such that after the filtering we had $params['limit'] + 1 results. Now we query $params['limit'] + 1 items and only then do the filtering, such that we can end up with less items (which also causes the continue element from vanishing).

Benoit74 subscribed.

This issue also impacts us at Kiwix since we are rolling out support of categories in ZIMs (offline Wikipedia archives).

We will implement a pretty obvious workaround (not filter hidden categories at API level but filter afterwards in the software), so there is not high urgency to solve this issue from our perspective.

I would appreciate if we can have a confirmation of which Mediawiki versions have been impacted by the bug (1.46 only for now, right?).

Thanks for your deep work, appreciated.

Zabe moved this task from Triage to In progress on the DBA board.

I would appreciate if we can have a confirmation of which Mediawiki versions have been impacted by the bug (1.46 only for now, right?).

Yes, 1.46 is the only stable release affected by this.

Change #1314865 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] api: Fetch additional rows in ApiQueryCategories when filtering reduces results

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

Change #1314865 merged by jenkins-bot:

[mediawiki/core@master] api: Fetch additional rows in ApiQueryCategories to have enough results

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

Change #1317602 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@REL1_46] api: Fetch additional rows in ApiQueryCategories to have enough results

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

Change #1317602 merged by jenkins-bot:

[mediawiki/core@REL1_46] api: Fetch additional rows in ApiQueryCategories to have enough results

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

Even with 20 iteration it is possible to get a result with less or zero results.

Some namespace filter in miser mode already have this (message api-help-param-limited-in-miser-mode, but in this case also for non-miser mode), so add a similiar documentation to api help page?