Page MenuHomePhabricator

Wikibase Bug: Unclear error message "save has failed"
Closed, DuplicatePublicBUG REPORT

Assigned To
None
Authored By
So9q
Feb 8 2022, 1:17 PM
Referenced Files
F34945540: image.png
Feb 8 2022, 2:12 PM
F34945538: image.png
Feb 8 2022, 2:12 PM
F34945488: bild.png
Feb 8 2022, 1:17 PM
F34945498: bild.png
Feb 8 2022, 1:17 PM

Description

List of steps to reproduce (step by step, including full links if applicable):

What happens?:

bild.png (1,432×540 px, 73 KB)

bild.png (1,918×839 px, 204 KB)

This cryptic error appears. It is not clear at all what is wrong.

What should have happened instead?:

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

Event Timeline

Terrible error messages like these push the user away. The system is unreliable, saving other statements work, sometimes. A system that cannot explain why it does not work as intended leads to bad UX.

Addshore subscribed.

Terrible error messages like these push the user away. The system is unreliable, saving other statements work, sometimes. A system that cannot explain why it does not work as intended leads to bad UX.

+1

This is a long term issue, and I believe this is the standard error message when URLs are used by new users in statements.
There are certainly some other phab tasks relating to this i think *finds them*

For wbstack i tracked this for https://github.com/wbstack/private/issues/4
Quoting from there...

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 (1,199×859 px, 318 KB)

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 (457×301 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...

And finally with some debugging...

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.
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.

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?

For wbstack i tracked this for https://github.com/wbstack/private/issues/4
Quoting from there...

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 (1,199×859 px, 318 KB)

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 (457×301 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...

And finally with some debugging...

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.
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.

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?

big thanks, I understand exactly what to do to solve it now (get elevated to admin). I circumvented it for now by creating a string property and using that instead 😎

@So9q Thank you so much for sharing this! I had the same problem and the culprit turned out to be Extension:ConfirmEdit. It is enabled by default, at least in the Wikibase Docker images. Had a gut feeling about this extension before, but only after I found your info did I decide to test it, which confirmed my suspicions. I haven't looked at its code, but I wouldn't be surprised if it isn't compatible with Wikibase, because of the different UI (or code paths).

The simplest workaround, obviously, is disabling the extension completely. But having a captcha at least on the login screen is probably a good idea, so the configuration may be used for some less radical solutions: not requiring captcha for various user groups (any registered, emailconfirmed, autoconfirmed, etc.), skipping the captcha for specific actions (e.g. addurl) and/or specific namespaces (e.g. NS_ITEM, NS_PROPS), URL and IP allowlists, etc.

In my case I'm probably leaning towards skipping the captcha for the registered users, because all our registrations are vetted.