Last modified: 2014-04-30 13:12:08 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
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
Change 116280 merged by jenkins-bot: (bug 62126) Retry creating a new page at wikidata. https://gerrit.wikimedia.org/r/116280
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':
The error message is 'wikibase-error-label-not-unique-item' See also https://gerrit.wikimedia.org/r/#/c/129964/
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.