Page MenuHomePhabricator

ParameterAssertionException: "Bad value for parameter $title: invalid name" (affects actions info, history, diff)
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error message
[XXd1MQpAICoAAC-ctdEAAAAN] /w/index.php?title=Audi&action=info   Wikimedia\Assert\ParameterAssertionException from line 63 of /srv/mediawiki/php-1.34.0-wmf.21/vendor/wikimedia/assert/src/Assert.php: Bad value for parameter $title: invalid name 'Brad_'
Impact
  • Unable to use the "Page information" link in the sidebar of some pages (action=info).
  • Unable to view the diff of some old revisions (diff=…)
  • Unable to paginate through the page history of some pages if the list of 50 rev would contain that one bed rev (action=history).

Example:

Notes

Details

Request ID
XXd1MQpAICoAAC-ctdEAAAAN
Request URL
https://en.wikipedia.org/w/index.php?title=Audi&action=info
Stack Trace
#0 /srv/mediawiki/php-1.34.0-wmf.21/includes/title/TitleValue.php(104): Wikimedia\Assert\Assert::parameter(boolean, string, string)
#1 /srv/mediawiki/php-1.34.0-wmf.21/includes/title/NamespaceInfo.php(205): TitleValue->__construct(integer, string)
#2 /srv/mediawiki/php-1.34.0-wmf.21/includes/Title.php(1552): NamespaceInfo->getTalkPage(Title)
#3 /srv/mediawiki/php-1.34.0-wmf.21/includes/actions/InfoAction.php(551): Title->getTalkPage()
#4 /srv/mediawiki/php-1.34.0-wmf.21/includes/actions/InfoAction.php(124): InfoAction->pageInfo()
#5 /srv/mediawiki/php-1.34.0-wmf.21/includes/actions/FormlessAction.php(43): InfoAction->onView()
#6 /srv/mediawiki/php-1.34.0-wmf.21/includes/MediaWiki.php(507): FormlessAction->show()
#7 /srv/mediawiki/php-1.34.0-wmf.21/includes/MediaWiki.php(302): MediaWiki->performAction(Article, Title)
#8 /srv/mediawiki/php-1.34.0-wmf.21/includes/MediaWiki.php(892): MediaWiki->performRequest()
#9 /srv/mediawiki/php-1.34.0-wmf.21/includes/MediaWiki.php(523): MediaWiki->main()
#10 /srv/mediawiki/php-1.34.0-wmf.21/index.php(42): MediaWiki->run()
#11 /srv/mediawiki/w/index.php(3): include(string)
#12 {main}
Related Changes in Gerrit:

Event Timeline

I dug a bit, and it seems action=info does not perform the usual normalisations and follow redirects that usually happen in MW (perhaps because this exception happens too early?). In this instance, there is one rewrite and one redirect: User:Brad_ -> User:Brad -> User:Bradley0110 (the first is a rewrite, i.e. the trailing _ is simply dropped, while the latter is a MW-level redirect).

The same problem occurs on: https://en.wikipedia.org/w/index.php?title=Audi&dir=prev&action=history

It seems that the first revision of that page is recorded to have been created by a user with the name "Brad_", which is invalid these days due to the trailing underscore:

https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&prop=revisions&titles=Audi&rvprop=ids%7Ctimestamp%7Cflags%7Ccomment%7Cuser%7Cuserid&rvlimit=1&rvdir=newer

{
    "continue": {
        "rvcontinue": "20020225154311|52561",
        "continue": "||"
    },
    "query": {
        "pages": {
            "848": {
                "pageid": 848,
                "ns": 0,
                "title": "Audi",
                "revisions": [
                    {
                        "revid": 234233,
                        "parentid": 0,
                        "minor": "",
                        "user": "Brad_",
                        "userid": 2594078,
                        "timestamp": "2001-09-26T12:34:19Z",
                        "comment": "Added English translation of Vorsprung durch Technik"
                    }
                ]
            }
        }
    }
}

But querying for an user with that ID, we get a "Brad":

https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&list=users&ususerids=2594078

{
    "batchcomplete": "",
    "query": {
        "users": [
            {
                "userid": 2594078,
                "name": "Brad"
            }
        ]
    }
}

Is this an incomplete rename (from 2008-ish…) or something else?

mmodell set Phatality ID (Deprecated) to acec09257899afb77e8691657bb18ab6961d9cffa281e0ac128176ffdfc01524.Sep 25 2019, 9:52 PM
mmodell raised the priority of this task from Low to Medium.Sep 25 2019, 10:04 PM
mmodell subscribed.

I don't think this is low priority as it happens quite often and creates logspam.

It seems that due to the actor migration the api now says it is anon

{
    "continue": {
        "rvcontinue": "20020225154311|52561",
        "continue": "||"
    },
    "query": {
        "pages": {
            "848": {
                "pageid": 848,
                "ns": 0,
                "title": "Audi",
                "revisions": [
                    {
                        "revid": 234233,
                        "parentid": 0,
                        "minor": "",
                        "user": "Brad_",
                        "anon": "",
                        "userid": 0,
                        "timestamp": "2001-09-26T12:34:19Z",
                        "comment": "Added English translation of Vorsprung durch Technik"
                    }
                ]
            }
        }
    }
}

So actor migration has identify this as a new user/actor and created a row for it.

In my opinion the database must be clean up and nothing to do on the gui side, because it also affect history or a diff to this version. Every place where the user name is shown.

Maybe we need another task to clean up the actor table to not hold invalid user names or ip addresses (Calling User::isValidUserName on each row)

I have started a query to see how many users ends with underscore on enwiki - https://quarry.wmflabs.org/query/40392

Krinkle renamed this task from Mediawiki info action throws Bad value for parameter $title: invalid name 'Brad_' to ParameterAssertionException: "Bad value for parameter $title: invalid name" (affects actions info, history, diff).Mar 16 2020, 6:28 PM
Krinkle updated the task description. (Show Details)

I have started a query to see how many users ends with underscore on enwiki - https://quarry.wmflabs.org/query/40392

This query says it's still "executing" and it's five months later??

I just tried the page info, and its still an issue [Xo8@NQpAIDAAAE898msAAADG] 2020-04-09 15:24:37: Fatal exception of type "Wikimedia\Assert\ParameterAssertionException"

I just tried the page info, and its still an issue [Xo8@NQpAIDAAAE898msAAADG] 2020-04-09 15:24:37: Fatal exception of type "Wikimedia\Assert\ParameterAssertionException"

The task is open and the username is still there. Why do you think it will disappear?

I just tried the page info, and its still an issue [Xo8@NQpAIDAAAE898msAAADG] 2020-04-09 15:24:37: Fatal exception of type "Wikimedia\Assert\ParameterAssertionException"

The task is open and the username is still there. Why do you think it will disappear?

Its been almost a full release cycle, so I was hoping

Change 611738 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/core@master] Validate local user name in ExternalUserNames::getUserLinkTitle

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

Krinkle raised the priority of this task from Medium to High.Jul 22 2020, 7:09 PM
Krinkle subscribed.

Fatal error on a core user action, deterministically making some page titles unauditable for all users.

Including:

In addition to affecting end users, due to these being uncachable and trivially triggerable by mere URL, these also cause noise and raise general error levels, affecting deployments and SRE alerts.

Change 611738 abandoned by Umherirrender:
[mediawiki/core@master] Validate local user name in ExternalUserNames::getUserLinkTitle

Reason:
Needs another strategy

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

daniel subscribed.

This was stuck in the hidden (backlock) column, needs attention.

Looks like this is triggered by invalid user names in the actor table:

> select rev_id, rev_timestamp, rev_actor, actor_user, actor_name from revision join actor on rev_actor = actor_id where rev_page = 8035619 and rev_timestamp <= "20100102120249" order by rev_timestamp desc  limit 50;

...

| 130477420 | 20091221015106 |  10630425 |       NULL | Alex
 Alex Lep            |

So actor 10630425 has a line break in the name.

We should probably be more defensive about creating user links from bad names. We should log such inceidents, but they shouldn't make the request fail.

Change 659329 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Linker: userLink() should not explode on malformed user names.

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

Change 659329 merged by jenkins-bot:
[mediawiki/core@master] Linker: userLink() should not explode on malformed user names.

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

Umherirrender assigned this task to daniel.