Page MenuHomePhabricator

Useless red error pops up when non confirmed user tries to add a URL on wbcloud
Closed, DuplicatePublic

Assigned To
None
Authored By
Addshore
Jun 11 2022, 5:08 PM
Referenced Files
F35229546: image.png
Jun 11 2022, 5:08 PM
F35229544: image.png
Jun 11 2022, 5:08 PM
F35229548: image.png
Jun 11 2022, 5:08 PM
F35229542: image.png
Jun 11 2022, 5:08 PM

Description

Reported by @OlafJanssen on wbstack back in October 2019 and now also for WBCloud in June 2022.


From Telegram:

I was playing with a wikibase.cloud instance trying to add a url to a Qitem, but got a red error popup. I remember from earlier discussion this had to do with user privileges, where autoconfirmed users (the default when you create a new user in the wb instance) don't have the right to save urls (because of spam prevention?). As far as I can see, there is no admin-like access to the wb instance, and I can't upgrade myself to a more powerful user group. How can I proceed in order to be able to save urls?


Original ticket ivestigation for wbstack by @Addshore

Wiki: https://kbtestwikibase.wiki.opencura.com/wiki/Main_Page Reported by: Olaf

Adam I set up a Wikibase via wbstack.com. First I created a property P1 : Same as, of Type URL. Then I created P2 Instance of. Then I want to add a P1 statement to P2 (same as P31 on Wikidata), and give it the value 'https://www.wikidata.org/entity/P31, and try to save that URL, it gives me an error message Failed to Save. Any ideas what might be wrong?

Trying to add a value to a P1 statement on https://kbtestwikibase.wiki.opencura.com/wiki/Property:P2 of https://www.wikidata.org/entity/P31

API Response:

{
  "error": {
    "code": "failed-save",
    "info": "The save has failed.",
    "messages": [
      {
        "name": "wikibase-api-failed-save",
        "parameters": [],
        "html": {
          "*": "The save has failed."
        }
      }
    ],
    "*": "See https://kbtestwikibase.wiki.opencura.com/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
  }
}

image.png (859×1 px, 318 KB)

image.png (486×1 px, 99 KB)

Tried debugging in eval.php to see if the proeprty info lookup was returning something bad, but it all looks good:

$r = \Wikibase\Repo\WikibaseRepo::getDefaultInstance();
$l = $r->getStore()->getPropertyInfoLookup();
$x = $l->getPropertyInfo( new Wikibase\DataModel\Entity\PropertyId( 'P2' ) );

image.png (639×1 px, 449 KB)

Tried reproducing on another wbstack wiki, and everything seemed to be fine there..

See recent history of https://addshore-alpha.wiki.opencura.com/w/index.php?title=Item:Q1&action=history

Looking at the code paths it is probably coming from

https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/master/repo/includes/Api/EntitySavingHelper.php#L419

then hitting

https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/master/repo/includes/Api/EntitySavingHelper.php#L445

which ends up with the user.

So we are hitting EditEntity::ANY_ERROR and EditEntity is what is erroring.

Looking at EditEntity, that means it could be any one of these types of error (as these are the only time an error is set)

image.png (301×457 px, 23 KB)

Generally in the status returned the value of errorFlags seems to be set to something that would help us determine what is happening.

This status does make it into ApiErrorReporter::dieStatus, but it doesnt look like the value itself is returned? Could file an upstream issue for this...

After the above debugging I can get a log of:

[info] [WBSTACK] Wikibase\Repo\Api\EntitySavingHelper::handleStatus: {"errorFlags":32}

This relates to:

	/**
	 * Indicates that the content triggered an edit filter that uses
	 * the EditFilterMergedContent hook to supervise edits.
	 */
	/* public */ const FILTERED = 32;

FILTERED will be returned as a result of editFilterHookRunner hooks failing

Looking at kbtestwikibase I see that both I when testing and the user editing that reported the issue are not admins.

!image

When I was testing on a second site I was using the default created admin user, and it was working.

On https://addshore-alpha.wiki.opencura.com/wiki/Item:Q1 I created a new user and then encountered the issue.

Probably to do with adding a link, and some extension that stops this.

Promoted the user for now:

mediawiki-app-web-794b8964b6-8l2hr:/var/www/html# WW_DOMAIN=kbtestwikibase.wiki.opencura.com php ./maintenance/createAndPromote.php Ookgezellig --force --custom-groups "sysop,bureaucrat"
[debug] [Wikibase] Wikibase\SettingsArray::getSetting: setting conceptBaseUri was given as a closure, resolve it to 'http://kbtestwikibase.wiki.opencura.com/entity/'
mwdb_983f310b60-mwt_077a4e1503_: Promoting User:Ookgezellig into sysop, bureaucrat...
done.

This task still needs tackling though.

To investigate:

  • Which extension filter actually caused this?
  • What is the desired default behaviour here for site owners / users?

And then probably do one of: 1 - Upstream error should be better, so that the user knows what is going on 2 - Do not stop new users from adding links?

Event Timeline

Solving T310421 may be the fix for this issue on wbstack and wbcloud, but resolving T310421does snot automatically mean this will be resolved in wbstack.
So let's keep these seperate