Last modified: 2014-04-30 13:12:08 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T64126, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 62126 - Make Pywikibot not crash on new item creation bug
Make Pywikibot not crash on new item creation bug
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
Wikidata (Other open bugs)
core-(2.0)
All All
: Unprioritized critical
: ---
Assigned To: Pywikipedia bugs
https://bugzilla.wikimedia.org/show_b...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-02 15:31 UTC by Maarten Dammers
Modified: 2014-04-30 13:12 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Maarten Dammers 2014-03-02 15:31:01 UTC
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
Comment 1 Gerrit Notification Bot 2014-03-02 16:23:04 UTC
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
Comment 2 Gerrit Notification Bot 2014-03-21 22:37:47 UTC
Change 116280 merged by jenkins-bot:
(bug 62126) Retry creating a new page at wikidata.

https://gerrit.wikimedia.org/r/116280
Comment 3 John Mark Vandenberg 2014-04-30 08:00:17 UTC
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':
Comment 4 xqt 2014-04-30 12:44:12 UTC
The error message is 'wikibase-error-label-not-unique-item'

See also https://gerrit.wikimedia.org/r/#/c/129964/
Comment 5 John Mark Vandenberg 2014-04-30 13:12:08 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links