Page MenuHomePhabricator

Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $title: should not be empty unless namespace is main
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $title: should not be empty unless namespace is main
exception.trace
from /srv/mediawiki/php-1.41.0-wmf.8/vendor/wikimedia/assert/src/Assert.php(72)
#0 /srv/mediawiki/php-1.41.0-wmf.8/includes/title/TitleValue.php(190): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.41.0-wmf.8/includes/title/TitleValue.php(144): TitleValue::assertValidSpec(integer, string, string, string)
#2 /srv/mediawiki/php-1.41.0-wmf.8/includes/specials/pagers/CategoryPager.php(97): TitleValue->__construct(integer, string)
#3 /srv/mediawiki/php-1.41.0-wmf.8/includes/pager/IndexPager.php(549): CategoryPager->formatRow(stdClass)
#4 /srv/mediawiki/php-1.41.0-wmf.8/includes/pager/IndexPager.php(586): IndexPager->getRow(stdClass)
#5 /srv/mediawiki/php-1.41.0-wmf.8/includes/specials/pagers/CategoryPager.php(93): IndexPager->getBody()
#6 /srv/mediawiki/php-1.41.0-wmf.8/includes/specials/SpecialCategories.php(78): CategoryPager->getBody()
#7 /srv/mediawiki/php-1.41.0-wmf.8/includes/specialpage/SpecialPage.php(701): MediaWiki\Specials\SpecialCategories->execute(NULL)
#8 /srv/mediawiki/php-1.41.0-wmf.8/includes/specialpage/SpecialPageFactory.php(1537): SpecialPage->run(NULL)
#9 /srv/mediawiki/php-1.41.0-wmf.8/includes/MediaWiki.php(328): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#10 /srv/mediawiki/php-1.41.0-wmf.8/includes/MediaWiki.php(925): MediaWiki->performRequest()
#11 /srv/mediawiki/php-1.41.0-wmf.8/includes/MediaWiki.php(579): MediaWiki->main()
#12 /srv/mediawiki/php-1.41.0-wmf.8/index.php(50): MediaWiki->run()
#13 /srv/mediawiki/php-1.41.0-wmf.8/index.php(46): wfIndexMain()
#14 /srv/mediawiki/w/index.php(3): require(string)
#15 {main}
Impact
Notes
  • This is the Special:Categories special page.

Details

Request URL
https://id.wikipedia.org/wiki/Istimewa:Daftar_kategori

Event Timeline

Umherirrender subscribed.

The sql behind the special page is

SELECT cat_title,cat_pages FROM category ORDER BY cat_title LIMIT 51

When running it on replica there is a row with cat_title = ''

MariaDB [idwiki_p]> SELECT * FROM `category` WHERE cat_title = '';
+---------+-----------+-----------+-------------+-----------+
| cat_id  | cat_title | cat_pages | cat_subcats | cat_files |
+---------+-----------+-----------+-------------+-----------+
| 9214846 |           |         1 |           0 |         0 |
+---------+-----------+-----------+-------------+-----------+
1 row in set (0.002 sec)

There is also a category entry for it:

MariaDB [idwiki_p]> SELECT * FROM `categorylinks` WHERE cl_to = '';
+---------+-------+-----------------------------+---------------------+-------------------+--------------+---------+
| cl_from | cl_to | cl_sortkey                  | cl_timestamp        | cl_sortkey_prefix | cl_collation | cl_type |
+---------+-------+-----------------------------+---------------------+-------------------+--------------+---------+
| 3919432 |       | DANAU_MORAINE\nDANAU MORAINE | 2023-05-06 15:28:14 | Danau_Moraine     | uppercase    | page    |
+---------+-------+-----------------------------+---------------------+-------------------+--------------+---------+
1 row in set (0.004 sec)

https://id.wikipedia.org/?curid=3919432 is a Story page, is that Wikistories ?

Maybe something like "fromArticle":{"articleTitle":"","originalText":""} results in empty category pages. Some validation is missing in core and/or the extension

Change 921129 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/Wikistories@master] StoryEditPage: Handle edge cases of `categories` input

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

Change 921129 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@master] StoryEditPage: Handle edge cases of `categories` input

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

Func claimed this task.
Func moved this task from Untriaged to May 2023 on the Wikimedia-production-error board.

In T336780: Wikimedia\Assert\ParameterAssertionException: Bad value for parameter $title: should not be empty unless namespace is main the way to insert bad data is fixed, but it seems the database does not clean up itself. So this could need some maintenance script interaction to fix the issue.

Hum, I tried an empty edit, and it ended up did something, but no lucks.

Hum, I tried an empty edit, and it ended up did something, but no lucks.

Actually, it half works, the Quarry query shows the page count dropped to zero but the category entry still exists. A run of cleanupEmptyCategories.php is needed.

Mentioned in SAL (#wikimedia-operations) [2023-07-03T13:21:38Z] <urbanecm> Run wikiadmin2023@10.64.16.184(idwiki)> DELETE FROM category` WHERE cat_title = ''; ` (T336780)

Hum, I tried an empty edit, and it ended up did something, but no lucks.

Actually, it half works, the Quarry query shows the page count dropped to zero but the category entry still exists. A run of cleanupEmptyCategories.php is needed.

Unfortunately, the script complained about category being invalid (which it is):

[urbanecm@mwmaint1002 ~]$ mwscript cleanupEmptyCategories.php --wiki=idwiki --force
Adding empty categories with description pages...
Removing empty categories without description pages...
The category named  is not valid?!
--mode=remove --begin=Rintisan_bertopik_Kiribati 
Category cleanup complete.
[urbanecm@mwmaint1002 ~]$

I decided to delete the incorrect entry manually. It should no longer be present:

wikiadmin2023@10.64.16.184(idwiki)> SELECT * FROM `category` WHERE cat_title = '';
Empty set (0.000 sec)

wikiadmin2023@10.64.16.184(idwiki)>