Page MenuHomePhabricator

Error "Result returned Aborted NeedToken expected" on edit
Open, HighPublicBUG REPORT

Description

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

  • Log into Huggle using a BotPassword, selecting the English Wikipedia
  • Patrol edits until you find one to revert. Revert the edit.

What happens?:
When Huggle makes the edit, an error is presented - Unable to login to wiki: Result returned Aborted NeedToken expected.
You are then presented with an option to relog, which has the same error message.
The relevant edit is never made.

To clarify: This bug doesn't always occur - some edits (e.g. https://en.wikipedia.org/wiki/Special:Permalink/1037090089) have worked. It seems that once the error occurs, Huggle will keep having the error for an arbitrary length of time, which leads me to believe a rate limit or similar?

What should have happened instead?:
Huggle makes the required edit

Have tried

  • Reinstalling Huggle
  • Using a nightly build (3rd August 2021)
  • Deleting my configuration folder so it regenerates
  • Regenerating the BotPassword
  • Changing the BotPassword grants

Have not tried

  • Running Huggle as huggle.exe --qd or huggle.exe --v for logging - this doesn't seem to do anything, as no logging file is created and there's no console output. Maybe worth noting that huggle.exe --help doesn't output any help text..

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

image.png (290×629 px, 26 KB)

  • Windows 10 Pro (build 19043)
  • Huggle version(s) 3.4.10 and Nightly 2021-08-03

Let me know if there's any other version numbers you'd like etc. I also note a similar bug request on-wiki.

Event Timeline

I also get this on simple, only when exiting the program though.

Closing and re-opening the application several times seems to get it to work; however, this is understandably tedious and frustrating. Whether this affects users without BotPasswords, I'm unsure, however disabling 2FA is not an option I would be willing to consider.

In true debugging fashion, wiring this up to Visual Studio's debugger to see if I can get anything useful has resulted in no instances of the bug at all. 😿

Hello,

First of all, regarding the console outputs - these work only in console (--help etc) you won't see any output if you start the application using link from desktop, these switches are more useful on UNIX systems, here is example:

$ ./huggle --help
Huggle 3

You can use following arguments to change the runtime settings:
  -v:              Increases verbosity
  --fuzzy:         Enable fuzzy localizations (these which were translated in past
                   but which were not updated since the source text has changed).
  --safe:          Start huggle in special mode where lot of stuff is skipped
                   during load
  --chroot <path>: Changes the home path of huggle to a given folder, so that huggle
                   reads a different configuration file and uses different data.
  --syslog [file]: Will write a logs to a file
  --version | -V:  Display a version
  --login:         Can be used in combination of --login-file only, this will tell huggle
                   to start login process immediately without letting you to change any login
                   preferences on login form
  --login-file:    Read a username and password from plain text file, separated by a colon
  -h | --help:     Display this help

Debugging options:
  --language-test: Will perform CPU expensive language test on startup, which reports
                   warnings found in localization files. This option is useful for
                   developers and people who create localization files
  --dot:           Debug on terminal only mode
  --qd [file]:     Write all transferred data to a file
  --override-conf [page]:
                   Will override the wiki configuration path, useful for testing of new config

JS related:
  --jslibs-dump:   Dump all built-in js libraries to std out

Note: every argument in [brackets] is optional
      but argument in <brackets> is required

Huggle is open source, contribute at https://github.com/huggle/huggle3-qt-lx

qd will produce a querydump.dat in current working directory, which is WD you start huggle in (can be defined via link in Windows).

Now to the bug itself - this is a very old bug that I am trying to fix, which is actually reason why many of debug switches were implemented. I don't really know if it's somewhere in MediaWiki or Huggle itself.

Basically what happens is that you login via API and then randomly MediaWiki starts reporting that you are no longer logged in (you can see exact RAW responses in querydump.dat, the flow of all HTTPS communication between your PC and MW). This bug is why I implemented re-login form which pops up when it happens and allows you to repeat login process instead of restarting Huggle.

Re-logging used to work and was decent workaround for this bug, but as you can see, it recently stopped working in some instances, it just ends up in endless login request loop. On first sight this looks like Huggle bug, but then, keep in mind that this used to work fine and now it suddenly has problems, despite Huggle is still same for at least a year and only thing that changed is MediaWiki.

What makes this bug harder to fix is also the fact that it's somewhat rare, as you said you won't see it easily when debugging. But if you did you would see that what happens is that MW started reporting you are logged off and refuses all your API requests.

Relogin form itself is triggered by function Configuration::Logout(WikiSite *site) which is called on multiple places, mostly when MW returns error code badtoken

Also I would like to stretch out that Huggle is very specific in its error messages, what you see is product of https://github.com/huggle/huggle3-qt-lx/blob/a57125fca76d1f5daa98896e3a3c00f146b2e555/src/huggle_ui/reloginform.cpp#L146

You can see result code of login API request is Aborted when Huggle expects it to be NeedToken. I don't know what has changed in MediaWiki recently that causes this, I don't know why it is Aborted, you might see it when you increase verbosity in logs window, or in query dump.

Heisenbug. Happened twice in a row, but disappeared when using --qd -vvv.

Console output without debug data:

tobefree@tobefree-linux:/tmp$ huggle
Qt: Session management error: Could not open network socket
QNetworkManagerInterface::QNetworkManagerInterface(QObject*) propsReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.111\" (uid=1000 pid=13400 comm=\"huggle \" label=\"snap.huggle.huggle (enforce)\") interface=\"org.freedesktop.DBus.Properties\" member=\"GetAll\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=1060 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")"
QNetworkManagerInterface::QNetworkManagerInterface(QObject*) nmReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.111\" (uid=1000 pid=13400 comm=\"huggle \" label=\"snap.huggle.huggle (enforce)\") interface=\"org.freedesktop.NetworkManager\" member=\"GetDevices\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=1060 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")"
"Object path cannot be empty"
Mi. Aug. 11 19:21:43 2021   Huggle version 3.4.11 build: 3901 3.4.10-21-gbd74c5c
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
Mi. Aug. 11 19:21:43 2021   Loading configuration
Mi. Aug. 11 19:21:43 2021   Home: /home/tobefree/snap/huggle/2773/.local/share/Wikimedia/Huggle
Mi. Aug. 11 19:21:43 2021   Loading plugins in /snap/huggle/2773/bin/extensions and /home/tobefree/snap/huggle/2773/.local/share/Wikimedia/Huggle/extensions/
Mi. Aug. 11 19:21:43 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_en.so
Mi. Aug. 11 19:21:43 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_flow.so
Mi. Aug. 11 19:21:43 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_md.so
Mi. Aug. 11 19:21:43 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_nuke.so
Mi. Aug. 11 19:21:43 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_scoring.so
Mi. Aug. 11 19:21:43 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_sh.so
Mi. Aug. 11 19:21:43 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_thanks.so
Mi. Aug. 11 19:21:43 2021   Extensions: 7
Mi. Aug. 11 19:21:43 2021   Loaded in 173ms
Mi. Aug. 11 19:21:43 2021   Loaded JS script: /snap/huggle/2773/bin/extensions/devtools.js
libGL error: pci id for fd 12: 1002:731f, driver (null)
libGL error: No driver found
libGL error: failed to load driver: (null)
libGL error: pci id for fd 12: 1002:731f, driver (null)
pci id for fd 13: 1002:731f, driver (null)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi
Mi. Aug. 11 19:21:55 2021   Connecting to recent changes stream on enwiki using provider: Wiki
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
Mi. Aug. 11 19:22:37 2021   Connecting to recent changes stream on enwiki using provider: IRC
Mi. Aug. 11 19:23:07 2021   enwiki: Connected to IRC recent changes feed
QIODevice::read (QNetworkReplyHttpImpl): device not open
Mi. Aug. 11 19:23:35 2021   ERROR: Scoring failed for edit Raspberry Pi: Timed out
Mi. Aug. 11 19:25:48 2021   ERROR: Did not revert Jaani (songwriter): rollback token was empty
Mi. Aug. 11 19:31:51 2021   WARNING: insufficient space in irc cache, increase ProviderCache size, otherwise you will be losing edits
Mi. Aug. 11 19:32:04 2021   WARNING: insufficient space in irc cache, increase ProviderCache size, otherwise you will be losing edits
Mi. Aug. 11 19:32:20 2021   SHUTDOWN: giving a gracetime to other threads to finish
Mi. Aug. 11 19:32:20 2021   SHUTDOWN: waiting for garbage collector to finish

Caught on exit with --qd -vvv

Mi. Aug. 11 20:36:30 2021   DEBUG[1]: Sending whitelist data of size: 30 byte to enwiki
Mi. Aug. 11 20:36:30 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038300444
Mi. Aug. 11 20:36:30 2021   DEBUG[2]: Queue: edit Maine Mendoza has lower score than MinScore, ignoring
Mi. Aug. 11 20:36:32 2021   DEBUG[2]: written
Mi. Aug. 11 20:36:32 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038300442
Mi. Aug. 11 20:36:32 2021   DEBUG[2]: Queue: edit Hamburger SV has lower score than MinScore, ignoring
Mi. Aug. 11 20:36:33 2021   DEBUG[1]: Query failed: assertuserfailed details: See https://en.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&gt; for notice of API deprecations and breaking changes.
Mi. Aug. 11 20:36:33 2021   DEBUG[1]: Session expired requesting a new login
Mi. Aug. 11 20:36:43 2021   DEBUG[1]: Splitter hits/misses: 1586/590
Mi. Aug. 11 20:36:43 2021   SHUTDOWN: giving a gracetime to other threads to finish
Mi. Aug. 11 20:36:43 2021   SHUTDOWN: waiting for garbage collector to finish
Mi. Aug. 11 20:36:44 2021   DEBUG[1]: GC: 85 objects
zsh: segmentation fault (core dumped)  huggle --qd -vvv
tobefree@tobefree-linux:/tmp$

No querydump.dat was created; no file containing the name "querydump" exists in the entire filesystem (updatedb, locate).

Caught with --qd querydump.dat -vvv. Again, no querydump file was created anywhere.

tobefree@tobefree-linux:/tmp$ huggle --qd querydump.dat  -vvv
Qt: Session management error: Could not open network socket
QNetworkManagerInterface::QNetworkManagerInterface(QObject*) propsReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.133\" (uid=1000 pid=22691 comm=\"huggle --qd querydump.dat -vvv \" label=\"snap.huggle.huggle (enforce)\") interface=\"org.freedesktop.DBus.Properties\" member=\"GetAll\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=1060 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")"
QNetworkManagerInterface::QNetworkManagerInterface(QObject*) nmReply "An AppArmor policy prevents this sender from sending this message to this recipient; type=\"method_call\", sender=\":1.133\" (uid=1000 pid=22691 comm=\"huggle --qd querydump.dat -vvv \" label=\"snap.huggle.huggle (enforce)\") interface=\"org.freedesktop.NetworkManager\" member=\"GetDevices\" error name=\"(unset)\" requested_reply=\"0\" destination=\"org.freedesktop.NetworkManager\" (uid=0 pid=1060 comm=\"/usr/sbin/NetworkManager --no-daemon \" label=\"unconfined\")"
"Object path cannot be empty"
Mi. Aug. 11 20:41:09 2021   Huggle version 3.4.11 build: 3901 3.4.10-21-gbd74c5c
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
Mi. Aug. 11 20:41:09 2021   Loading configuration
Mi. Aug. 11 20:41:09 2021   Home: /home/tobefree/snap/huggle/2773/.local/share/Wikimedia/Huggle
Mi. Aug. 11 20:41:09 2021   DEBUG[1]: Finished conf
Mi. Aug. 11 20:41:09 2021   DEBUG[1]: UserAgent: Huggle/3.4.11 (http://en.wikipedia.org/wiki/WP:Huggle; 3.4.11 build: 3901 3.4.10-21-gbd74c5c)
Mi. Aug. 11 20:41:09 2021   DEBUG[1]: Loading wikis
Mi. Aug. 11 20:41:09 2021   DEBUG[1]: Loading queue
Mi. Aug. 11 20:41:09 2021   Loading plugins in /snap/huggle/2773/bin/extensions and /home/tobefree/snap/huggle/2773/.local/share/Wikimedia/Huggle/extensions/
Mi. Aug. 11 20:41:09 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_en.so
Mi. Aug. 11 20:41:09 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_flow.so
Mi. Aug. 11 20:41:09 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_md.so
Mi. Aug. 11 20:41:09 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_nuke.so
Mi. Aug. 11 20:41:09 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_scoring.so
Mi. Aug. 11 20:41:09 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_sh.so
Mi. Aug. 11 20:41:09 2021   Successfully loaded: /snap/huggle/2773/bin/extensions/libhuggle_thanks.so
Mi. Aug. 11 20:41:09 2021   Extensions: 7
Mi. Aug. 11 20:41:09 2021   Loaded in 161ms
Mi. Aug. 11 20:41:09 2021   Loaded JS script: /snap/huggle/2773/bin/extensions/devtools.js
Mi. Aug. 11 20:41:10 2021   DEBUG[1]: checking for update at http://tools.wmflabs.org/huggle/updater/?version=3.4.11&os=linux%2Fsnap&language=en
Mi. Aug. 11 20:41:10 2021   DEBUG[2]: Processing webserver request http://tools.wmflabs.org/huggle/updater/?version=3.4.11&os=linux%2Fsnap&language=en
Mi. Aug. 11 20:41:10 2021   DEBUG[1]: SSL library: OpenSSL 1.0.2g  1 Mar 2016
libGL error: pci id for fd 12: 1002:731f, driver (null)
libGL error: No driver found
libGL error: failed to load driver: (null)
libGL error: pci id for fd 12: 1002:731f, driver (null)
pci id for fd 13: 1002:731f, driver (null)
libGL error: failed to create dri screen
libGL error: failed to load driver: radeonsi
Mi. Aug. 11 20:41:11 2021   DEBUG[2]: Finished request http://tools.wmflabs.org/huggle/updater/?version=3.4.11&os=linux%2Fsnap&language=en
Mi. Aug. 11 20:41:17 2021   DEBUG[2]: Token for enwiki rollback 15f4d4fa..........ade636ea8f273d611419cd+\
Mi. Aug. 11 20:41:17 2021   DEBUG[2]: Token for enwiki csrf e9764b92..........1511500a1fcdf4611419cd+\
Mi. Aug. 11 20:41:17 2021   DEBUG[2]: Token for enwiki watch 7e251fa3..........7c9c44485e68a8611419cd+\
Mi. Aug. 11 20:41:17 2021   DEBUG[2]: Token for enwiki patrol cfc5a702..........a1fdd2f92fd25b611419cd+\
Mi. Aug. 11 20:41:17 2021   DEBUG[1]: enwiki mediawiki 1.37.0-wmf.17
Mi. Aug. 11 20:41:20 2021   Connecting to recent changes stream on enwiki using provider: Wiki
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
Mi. Aug. 11 20:41:20 2021   DEBUG[1]: Loading state
Mi. Aug. 11 20:41:20 2021   DEBUG[1]: Loading geometry
Mi. Aug. 11 20:41:23 2021   Connecting to recent changes stream on enwiki using provider: IRC
Mi. Aug. 11 20:41:23 2021   enwiki: Connected to IRC recent changes feed
Mi. Aug. 11 20:41:38 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301050
Mi. Aug. 11 20:41:40 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301050
Mi. Aug. 11 20:41:40 2021   DEBUG[2]: Queue: edit I Knew You Were Trouble has lower score than MinScore, ignoring
Mi. Aug. 11 20:41:43 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301063
Mi. Aug. 11 20:41:44 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301063
Mi. Aug. 11 20:41:44 2021   DEBUG[2]: Queue: edit Richa Moorjani has lower score than MinScore, ignoring
Mi. Aug. 11 20:41:46 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301066
Mi. Aug. 11 20:41:47 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301068
Mi. Aug. 11 20:41:47 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301066
Mi. Aug. 11 20:41:47 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301069
Mi. Aug. 11 20:41:48 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301072
Mi. Aug. 11 20:41:49 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301072
Mi. Aug. 11 20:41:49 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301069
Mi. Aug. 11 20:41:49 2021   DEBUG[2]: Queue: edit The Kid Laroi has lower score than MinScore, ignoring
Mi. Aug. 11 20:41:50 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301075
Mi. Aug. 11 20:41:51 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301075
Mi. Aug. 11 20:41:53 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301068
Mi. Aug. 11 20:41:53 2021   DEBUG[2]: Queue: edit East Midlands Airport has lower score than MinScore, ignoring
Mi. Aug. 11 20:41:53 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301080
Mi. Aug. 11 20:41:55 2021   DEBUG[2]: Processing webserver request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301079
Mi. Aug. 11 20:41:55 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301080
Mi. Aug. 11 20:41:55 2021   DEBUG[2]: Queue: edit Zilan massacre has lower score than MinScore, ignoring
Mi. Aug. 11 20:41:55 2021   DEBUG[2]: Showing next edit
Mi. Aug. 11 20:41:55 2021   DEBUG[1]: Sending message to user 97.84.250.69
Mi. Aug. 11 20:41:56 2021   DEBUG[1]: Query failed: badtoken details: See https://en.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&gt; for notice of API deprecations and breaking changes.
Mi. Aug. 11 20:41:56 2021   ERROR: Did not revert Park Yeon-mi: rollback token was empty
Mi. Aug. 11 20:41:59 2021   DEBUG[2]: Finished request https://ores.wikimedia.org/v3/scores/enwiki?revids=1038301079
zsh: segmentation fault (core dumped)  huggle --qd querydump.dat -vvv
tobefree@tobefree-linux:/tmp$

That's because you are running it via snap, so it's running inside a container, therefore huggle is not allowed to create any files on real filesystem, it creates the dump in container overlay FS which is cleaned up by the snapd when it exits. You would need to run it natively without any such restrictions.

btw you can try give it some absolute path instead like --qd /home/tobefree/snap/huggle/2773/.local/share/Wikimedia/Huggle/dump

Same issue here, I entered my password again but it give the error "Unable to login to wiki: Result returned Aborted NeedToken expected". I'm using a bot account as I have 2FA enabled hence would needed the workaround as mentioned by the guide. I'm able to log in and rollback edits however it will randomly "kick me" out of the session with that error.

ok guys, it would really help if you could provide the querydump - I don't know which platform you are on, but if it's Windows, then you can just copy or modify Huggle shortcut and add --qd on end of it, then also change the working path to whatever path you want querydump to be stored in. You can also add a full path after like --qd C:\Temp\huggle.txt just make sure that huggle process will be able to write there.

without this dump it's hard to guess what is happening, I will try to keep running Huggle myself but so far I didn't hit this bug.

also keep in mind that querydump may contain data that some people consider sensitive (their on-wiki activity obviously and some tokens, that are most likely expired), so make sure you inspect whatever you are about to send. If you hit this bug, I will need just last few queries, here is example of querydump from my PC:

======================================
1 OUT GlobalWiki Fri Aug 13 22:59:11 2021
======================================
https://meta.wikimedia.org/w/api.php?action=query&prop=revisions&rvprop=content&rvlimit=1&titles=Huggle/Config.yaml&rawcontinue=1&format=xml
HEADERS:
User-Agent: Huggle/3.4.10 (http://en.wikipedia.org/wiki/WP:Huggle; 3.4.10 build: 3894 3.4.10-14-gdd330916)

======================================
1 IN GlobalWiki Fri Aug 13 22:59:11 2021
======================================
HEADERS:
Date: Fri, 13 Aug 2021 20:59:11 GMT
Server: mw2322.codfw.wmnet
X-Content-Type-Options: nosniff
P3p: CP="See https://meta.wikimedia.org/wiki/Special:CentralAutoLogin/P3P for more info."
X-Frame-Options: DENY
Content-Disposition: inline; filename=api-result.xml
Vary: Accept-Encoding,Treat-as-Untrusted,X-Forwarded-Proto,Cookie,Authorization
Cache-Control: private, must-revalidate, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Encoding: gzip
Age: 0
X-Cache: cp3062 miss, cp3056 pass
X-Cache-Status: pass
Server-Timing: cache;desc="pass", host;desc="cp3056"
Strict-Transport-Security: max-age=106384710; includeSubDomains; preload
Report-To: { "group": "wm_nel", "max_age": 86400, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" }] }
NEL: { "report_to": "wm_nel", "max_age": 86400, "failure_fraction": 0.05, "success_fraction": 0.0}
Permissions-Policy: interest-cohort=()
X-Client-IP: 94.112.0.211
Set-Cookie: WMF-Last-Access=13-Aug-2021;Path=/;HttpOnly;secure;Expires=Tue, 14 Sep 2021 12:00:00 GMT
GeoIP=CZ:10:Prague:50.10:14.55:v4; Path=/; secure; Domain=.wikimedia.org
Accept-Ranges: bytes
Connection: keep-alive


DATA:
<?xml version="1.0"?><api><query-continue><revisions rvcontinue="20190716173148|19206914" /></query-continue><warnings><main xml:space="preserve">Subscribe to the mediawiki-api-announce mailing list at &lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&gt; for notice of API deprecations and breaking changes. Use [[Special:ApiFeatureUsage]] to see usage of deprecated features by your application.</main><revisions xml:space="preserve">Because "rvslots" was not specified, a legacy format has been used for the output. This format is deprecated, and in the future the new format will always be used.</revisions></warnings><query><pages><page _idx="10411452" pageid="10411452" ns="0" title="Huggle/Config.yaml"><revisions><rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">{{Huggle/Header}}

This is the global configuration page for [[Huggle]] 3.2.1 and newer.

&lt;!-- HUGGLE:BOC --&gt;
&lt;syntaxhighlight lang=yaml&gt;
---
enable-all: true
min-version: "3.4.8"
config: "Project:Huggle/Config"
config-yml: "Project:Huggle/Config.yaml"
documentation: "https://www.mediawiki.org/wiki/Manual:Huggle"
feedback: "https://en.wikipedia.org/wiki/Wikipedia:Huggle/Feedback"
irc-server: "irc.wikimedia.org"
han-server: "irc.tm-irc.org"

# Deprecated since Huggle 3.3.4
user-agent: "Huggle/$1 http://en.wikipedia.org/wiki/Wikipedia:Huggle"
# This key exists for backward compatibility with configuration from legacy huggle
user-config: "Special:Mypage/huggle.css"
user-config-hg3: "Special:Mypage/huggle3.css"
# Let's keep default here for now
# user-config-yaml: "Special:Mypage/huggle.json"
whitelist-server: "https://huggle-wl.wmflabs.org/"
&lt;/syntaxhighlight&gt;</rev></revisions></page></pages></query></api>
======================================
2 OUT enwiki Fri Aug 13 22:59:11 2021
======================================
https://en.wikipedia.org/w/api.php?action=query&meta=tokens&type=login&rawcontinue=1&format=xml
HEADERS:
User-Agent: Huggle/3.4.10 (http://en.wikipedia.org/wiki/WP:Huggle; 3.4.10 build: 3894 3.4.10-14-gdd330916)

======================================
2 IN enwiki Fri Aug 13 22:59:12 2021
======================================
HEADERS:
Date: Fri, 13 Aug 2021 20:59:12 GMT
Server: mw2396.codfw.wmnet
X-Content-Type-Options: nosniff
P3p: CP="See https://en.wikipedia.org/wiki/Special:CentralAutoLogin/P3P for more info."
X-Frame-Options: SAMEORIGIN
Content-Disposition: inline; filename=api-result.xml
Cache-Control: private, max-age=0, s-maxage=0
Content-Type: text/xml; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Age: 0
X-Cache: cp3062 miss, cp3056 pass
X-Cache-Status: pass
Server-Timing: cache;desc="pass", host;desc="cp3056"
Strict-Transport-Security: max-age=106384710; includeSubDomains; preload
Report-To: { "group": "wm_nel", "max_age": 86400, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" }] }
NEL: { "report_to": "wm_nel", "max_age": 86400, "failure_fraction": 0.05, "success_fraction": 0.0}
Permissions-Policy: interest-cohort=()
X-Client-IP: 94.112.0.211
Set-Cookie: ss0-enwikiSession=8j1bvob5b716vcl4c6nr8j08jceo6ffr; path=/; secure; HttpOnly
enwikiSession=8j1bvob5b716vcl4c6nr8j08jceo6ffr; path=/; secure; HttpOnly; SameSite=None
WMF-Last-Access=13-Aug-2021;Path=/;HttpOnly;secure;Expires=Tue, 14 Sep 2021 12:00:00 GMT
WMF-Last-Access-Global=13-Aug-2021;Path=/;Domain=.wikipedia.org;HttpOnly;secure;Expires=Tue, 14 Sep 2021 12:00:00 GMT
GeoIP=CZ:10:Prague:50.10:14.55:v4; Path=/; secure; Domain=.wikipedia.org
Accept-Ranges: bytes
Connection: keep-alive


DATA:
<?xml version="1.0"?><api><query><tokens logintoken="d1c1b248d22aeb55d2c7fce374defdsf43dd20+\" /></query></api>
======================================
4 OUT enwiki Fri Aug 13 22:59:12 2021
======================================
(secret url) HEADERS:
User-Agent: Huggle/3.4.10 (http://en.wikipedia.org/wiki/WP:Huggle; 3.4.10 build: 3894 3.4.10-14-gdd330916)
Content-Type: application/x-www-form-urlencoded


DATA: (secret data)
======================================
4 IN enwiki Fri Aug 13 22:59:13 2021
======================================
HEADERS:
Date: Fri, 13 Aug 2021 20:59:12 GMT
Server: mw2370.codfw.wmnet
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Disposition: inline; filename=api-result.xml
Cache-Control: private, max-age=0, s-maxage=0
Set-Cookie: enwiki_BPsession=nnk365hrj8g2g3p4l2m4j4t5i51je6st; path=/; secure; HttpOnly
loginnotify_prevlogins=2021-5v08gr-m5dnmwymm8pgoy3w64sq4olr4ecixz1; expires=Wed, 09-Feb-2022 20:59:13 GMT; Max-Age=15552000; path=/; secure; HttpOnly
cpPosIndex=2%401628888353%23c924c7d788aad46b366b34ab345e258b; expires=Fri, 13-Aug-2021 20:59:23 GMT; Max-Age=10; path=/; secure; HttpOnly
UseDC=master; expires=Fri, 13-Aug-2021 20:59:23 GMT; Max-Age=10; path=/; secure; HttpOnly
UseCDNCache=false; expires=Fri, 13-Aug-2021 20:59:23 GMT; Max-Age=10; path=/; secure; HttpOnly
Content-Type: text/xml; charset=utf-8
Content-Encoding: gzip
Vary: Accept-Encoding
Age: 2
X-Cache: cp3060 miss, cp3056 pass
X-Cache-Status: pass
Server-Timing: cache;desc="pass", host;desc="cp3056"
Strict-Transport-Security: max-age=106384710; includeSubDomains; preload
Report-To: { "group": "wm_nel", "max_age": 86400, "endpoints": [{ "url": "https://intake-logging.wikimedia.org/v1/events?stream=w3c.reportingapi.network_error&schema_uri=/w3c/reportingapi/network_error/1.0.0" }] }
NEL: { "report_to": "wm_nel", "max_age": 86400, "failure_fraction": 0.05, "success_fraction": 0.0}
Permissions-Policy: interest-cohort=()
X-Client-IP: 94.112.0.211
Accept-Ranges: bytes
Connection: keep-alive


DATA:
<?xml version="1.0"?><api><login result="Success" lguserid="13249226" lgusername="Petrb" /></api>

I would only need to see about 20 last queries (http requests) from such dump to see the huggle <-> MW conversation that preceeded and resulted in this problem

Changing/resetting my BotPassword has fixed this by the looks of things

This bug happens on my instance of Huggle as well (after trying to make any edit; the login works just fine). Previously, it was possible to workaround this by restarting Huggle, but that does not work anymore. Debugging data from my end are at P17291. I did do a quick review for sensitive data (and redacted some obvious data, like cookies and IP addresses; you might want to redact that by default), but since it's 800K+ of data, I'm pasting it as a confidential patch just to be sure -- I might've missed something easily.

The error in the action=rollback call itself is:

<?xml version="1.0"?><api servedby="mw1400"><error code="badtoken" info="Invalid CSRF token." xml:space="preserve">See https://en.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &amp;lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&amp;gt; for notice of API deprecations and breaking changes.</error></api>

which is not surprising, as Huggle itself complains about an invalid token. However, what I would expect to see is an attempt to refresh the remembered token used by huggle. AFAICS, the tokens get fetched early in the application, and then never again. Since tokens can become invalid at arbitrary time, might be time limited (noted in the docs).

To guard against invalid tokens a bit more, I would recommend catching the badtoken error, and if it happens, I'd try to call action=query&meta=tokens&type=XXX again, refreshing the tokens stored by the application, and then retry the failed call with the new token. This should rule out "token is just invalid" easily.

This might not fix my case, since I can reproduce the error even on the first edit, but it would likely fix the issue with long-running huggle using an expired token.

I'm not sure what happened, but Huggle works without issues now.

I really hate to be "that person", but this has been working okay for me until recently - same error :(

Tried to reproduce it yesterday. Almost every time directly after login (updating huggle userlist) or logout (updating preferences). No really an idea why esp. directly after login the token is bad, looked at request log is the correct one fetched seconds before. And then suddently after trying to debug (as always :D ) or random after dozens of tries it works.

To guard against invalid tokens a bit more, I would recommend catching the badtoken error, and if it happens, I'd try to call action=query&meta=tokens&type=XXX again, refreshing the tokens stored by the application, and then retry the failed call with the new token. This should rule out "token is just invalid" easily.

Would follow @Urbanecm idea. Esp. since the current handling flow is broken: "Logging out" and the reloginform uses the normal username, and not bot login. Also it seems that login in is not supportet anyway in the current implementation ("Cannot log in when using MediaWiki\Session\BotPasswordSessionProvider sessions.") or something is broken (possible need to clear cookies before logging in again).

Hm...

hmm I will try to look into this soonish, I am quite busy these days, but from what I remember it's indeed nearly impossible to relogin when using bot password. But I can try to see what that meta=tokens query would do, maybe we are still logged in, just the tokens indeed got invalidated. I have to admit I never knew they can randomly be invalidated, I thought they are supposed to be valid for the time of whole session.

I'm also busy and still setting up my dev env again, but that's my current status:

@@ -152,13 +152,15 @@ bool EditQuery::IsProcessed()
                 {
                     reason = _l("editquery-error-badtoken");
                     hec = HUGGLE_ETOKEN;
                     // we log off the site
                     this->Suspend();
-                    Configuration::Logout(this->Page->GetSite());
+                    //Configuration::Logout(this->Page->GetSite());
                     Syslog::HuggleLogs->ErrorLog(_l("editquery-invalid-token", this->Page->PageName));
                     this->qEdit.Delete();
+                    WikiUtil::RetrieveTokens(this->Page->GetSite());
+                    // error handling in case of failure is bad
                     return false;
                 } else
                 {
                     // We don't want to process failure in case the query was suspended
                     this->Result = new QueryResult(true);

I have tried the above modification. This works for the edit queries (on user config save on exit), but the error happens for the others queries with token (esp. revert and patrol) as well. I'm also surprised why the token got invalid (esp. even after some seconds), but we are still logged in.
Seems a general solution for all queries with token on ec=badtoken is needed (or just replace on all current places). And probably some flag or counter to only restart a query once or twice on token failure.

I may have successfully reproduced this bug on Windows. I don't know specifically what is in a querydump, and I don't necessarily have the time to pour over it (it's 734KB) but if @Petrb wants to take a look, ping me on IRC and I will gladly send you my full, unredacted querydump file.

Also just would just like to drop a note, using a BotPassword with or without 2FA triggers the Aborted NeedToken error as well.

If it's any help for the sake of reproduciblity, I only just now ran into this issue (I'd heard about it in the past, but never experienced it myself) with the only recent change being that I logged myself out of my Wikipedia account a few days ago (this is the first time I've opened Huggle since then). I've dumped the relevant logs in P30996.

I have hit this. Query dump is at P31153. Its last dump was "Cannot log in when using MediaWiki\Session\BotPasswordSessionProvider sessions." and then it segfaults.

I have run into this on simple Wikipedia as well. I believe I also opened a ticket long ago that would freeze and present the same message about having to relog. I would log back in and get the same message repeatedly, so I gave up using huggle and went to RW and Twinkle combined.

Same thing still occurs for me as well

Same thing was occuring to me at the end of last August. I noticed personally it was when I used enwiki and simplewiki in Huggle instead of just enwiki - maybe something to do with it?

Occurred to me again, after trying to report someone to AIV, Huggle instantly closed itself. When reopening Huggle to revert, it now reports the error.

Seems to actually be fixed, did a test edit on my talk page, and reverted using Huggle while logged in with a BotPassword and it went through, will continue testing, this is with version 3.4.12.

Yoshi24517 closed this task as Resolved.EditedFeb 17 2023, 8:08 PM

This I believe is fully fixed as of version 3.4.12. I'm editing without any issues whatsoever after continuing to test. Feel free to reopen if this issue pops up again.

Hummerrocket subscribed.

Unfortunately, I am still hitting this error. I ensured that I am on version 3.4.12, which I downloaded, and it says I am on 3.4.12 when I launch Huggle. However, when attempting to add any page to a watchlist (Alt + X), I get the same error repeatedly ("It looks like you were logged out of MediaWiki for whatever reason").

This comment was removed by Yoshi24517.

Unfortunately, I am still hitting this error. I ensured that I am on version 3.4.12, which I downloaded, and it says I am on 3.4.12 when I launch Huggle. However, when attempting to add any page to a watchlist (Alt + X), I get the same error repeatedly ("It looks like you were logged out of MediaWiki for whatever reason").

Reposting comment to quote.

Relogging usually fixes the problem. It used to not fix it, but after updating to 3.4.12, closing Huggle all the way and rerunning it only once fixes the problem.

Is it actually saying "Aborted, needToken"? Because there is the other error where the "logged out of MediaWiki" error shows up by itself.

Actually, it doesn't say "Aborted, needed token", it only spams the "logged out of MediaWiki" error. I thought that these two errors are closely related, since the image in the bug description also has a dialog box for the "logged out of MediaWiki" error.
Nevertheless, exiting and logging back in did not fix the error :(

Actually, it doesn't say "Aborted, needed token", it only spams the "logged out of MediaWiki" error. I thought that these two errors are closely related, since the image in the bug description also has a dialog box for the "logged out of MediaWiki" error.
Nevertheless, exiting and logging back in did not fix the error :(

Normally what you have to do if this happens, is just put your password back in, this happens if MW logs you out for some funny reason. If you have your password saved, just click relog, if not, put in your password and then click relog, and that usually fixes it.

Normally what you have to do if this happens, is just put your password back in, this happens if MW logs you out for some funny reason. If you have your password saved, just click relog, if not, put in your password and then click relog, and that usually fixes it.

Sadly I tried that by re-inputting my password, but even then that same dialog box keeps popping up regardless.

FYI, I am having the same issue today with a Botpassword with 2FA, I didn't have the issue mid June.

It worked after a password reset and closing/reopenning Huggle twice. Weird (I'll try to dig out some logs next time)

Can this issue be fixed at some point? I'm at 5 relogs with the issue still occurring after each relog, and it is driving me up the wall.

Possible fix over at T310766, I’m going to test tomorrow but would like others to test as well.