https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
Bug ID: 62126 Summary: Make Pywikibot not crash on new item creation bug Product: Pywikibot Version: core (2.0) Hardware: All URL: https://bugzilla.wikimedia.org/show_bug.cgi?id=46535 OS: All Status: NEW Severity: normal Priority: Unprioritized Component: Wikidata Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: maarten@mdammers.nl Web browser: --- Mobile Platform: ---
See https://bugzilla.wikimedia.org/show_bug.cgi?id=46535 . Everyone once in a while you'll get an apierror when trying to create a new page:
File "C:\pywikibot\core\pywikibot\page.py", line 2523, in editEntity baserevid=baserevid, **kwargs) File "C:\pywikibot\core\pywikibot\site.py", line 721, in callee return fn(self, *args, **kwargs) File "C:\pywikibot\core\pywikibot\site.py", line 3725, in editEntity data = req.submit() File "C:\pywikibot\core\pywikibot\data\api.py", line 401, in submit raise APIError(code, info, **result["error"]) pywikibot.data.api.APIError: failed-save: Could not create a new page. It already exists. <class 'pywikibot.data.api.APIError'>
Error should be caught somewhere in the lower layers and it should be retried (just like with connection problems). It should respect maxretries so it doesn't get stuck in a loop
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
Andre Klapper aklapper@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |critical
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
--- Comment #1 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 116280 had a related patch set uploaded by Xqt: (bug 62126) Retry creating a new page at wikidata.
https://gerrit.wikimedia.org/r/116280
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |info@gno.de See Also| |https://bugzilla.wikimedia. | |org/show_bug.cgi?id=46535
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
--- Comment #2 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 116280 merged by jenkins-bot: (bug 62126) Retry creating a new page at wikidata.
https://gerrit.wikimedia.org/r/116280
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
xqt info@gno.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |RESOLVED Resolution|--- |FIXED
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
John Mark Vandenberg jayvdb@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jayvdb@gmail.com
--- Comment #3 from John Mark Vandenberg jayvdb@gmail.com --- I think this bug should only force a retry if the reason the save failed is 'edit-already-exists'
i.e. pseudocode in api.py
-if code == "failed-save" and action == 'wbeditentity': +if code == "failed-save" and action == 'wbeditentity' and info == 'Could not create a new page.\nIt already exists.':
or
-if code == "failed-save" and action == 'wbeditentity': +if code == "failed-save" and action == 'wbeditentity': + messages = result["error"].pop("messages", None) + if messages and messages['0'] and messages['0']['name'] == 'edit-already-exists':
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
--- Comment #4 from xqt info@gno.de --- The error message is 'wikibase-error-label-not-unique-item'
See also https://gerrit.wikimedia.org/r/#/c/129964/
https://bugzilla.wikimedia.org/show_bug.cgi?id=62126
--- Comment #5 from John Mark Vandenberg jayvdb@gmail.com --- The error we should not resubmit is 'wikibase-error-label-not-unique-item'.
The only error we should retry is 'edit-already-exists'.
That code and my pseudo-code above do the same thing, in different ways.
pywikipedia-bugs@lists.wikimedia.org