Page MenuHomePhabricator

Random api errors
Closed, ResolvedPublic

Description

I'm running several bots and every once in a while a bot crashes:

Adding new template claim to [[wikidata:Q6614219]]
Traceback (most recent call last):
  File "C:\pywikibot\core\add_template.py", line 120, in <module>
    main()
  File "C:\pywikibot\core\add_template.py", line 117, in main
    bot.run()
  File "C:\pywikibot\core\add_template.py", line 52, in run
    item.addClaim(newclaim)
  File "C:\pywikibot\core\pywikibot\page.py", line 2676, in addClaim
    self.repo.addClaim(self, claim, bot=bot, **kwargs)
  File "C:\pywikibot\core\pywikibot\site.py", line 709, in callee
    return fn(self, *args, **kwargs)
  File "C:\pywikibot\core\pywikibot\site.py", line 3578, in addClaim
    data = req.submit()
  File "C:\pywikibot\core\pywikibot\data\api.py", line 394, in submit
    raise APIError(code, info, **result["error"])
pywikibot.data.api.APIError: badtoken: * '''Sorry! We could not process your edit due to a loss of session data.'''
Please try again.
If it still does not work, try [[Special:UserLogout|logging out]] and logging back in.
* There seems to be a problem with your login session;
this action has been canceled as a precaution against session hijacking.
Go back to the previous page, reload that page and then try again.

This exception should be caught and the addClaim should be retried.

Maybe a Wikidata bug should be filed too to figure out why we seem to loose session data every once in a while


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=59678

Details

Reference
bz54311

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 2:00 AM
bzimport added a project: Pywikibot-Wikidata.
bzimport set Reference to bz54311.
bzimport added a subscriber: Unknown Object (????).
Xqt added a comment.Jun 6 2014, 11:39 AM

Is this bug still valid?

It is, I still see it every once in a while.

Frankly I think it's bug of Wikidata not pywikibot, the fast solution could be catching the error and retrying (like network unreachable error)

jayvdb added a comment.EditedSep 18 2014, 9:20 AM

It looks like bug T61678 is a dup of this bug.

jayvdb moved this task from Backlog to Framework on the Pywikibot-Wikidata board.Nov 30 2014, 12:11 PM
jayvdb updated the task description. (Show Details)Feb 17 2015, 10:48 AM
jayvdb set Security to None.
Mpaa added a subscriber: Mpaa.Feb 17 2015, 7:50 PM

And of this one as well: T89702

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 8 2015, 8:00 PM
jayvdb added a comment.Oct 8 2015, 8:02 PM

Has this problem occurred since about April 2015 when T61678: Implement badtoken detection and recovery was fixed?

Has this problem occurred since about April 2015 when T61678: Implement badtoken detection and recovery was fixed?

A lot of things have changed since this bug was filed. Pywikibot is much more stable. Let's close this one as resolved. If we run into new problems we can file a new more specific bug.

jayvdb closed this task as Resolved.Oct 12 2015, 7:45 PM
jayvdb claimed this task.