synchronisation has not worked for months: `TokenMismatchException`
This issue respects the following points:
- [x] I have read the FAQ
- [x] I have searched for existing issues
- [x] The issue affects the Notes Android app, neither the Notes server app nor the Nextcloud Android app.
Describe the bug
Open Notes app Get error message: Synchronisation Failed
Expected behavior
- No issues connecting to the sever.
- I have removed and reinstalled the app without succes.
- I can read the existing notes, but nothing newer than december 2024.
- Notes app on desktop works as expected.
Notes Android version
4.3.1
Notes server version
see below
Nextcloud Android version
??
Nextcloud version
See below
Device
OnePlus Nord, CPH2663
Android Version
6.1.75-android14-11
App Store
- [x] Google Play Store
- [ ] F-Droid
- [ ] Huawei App Gallery
Stacktrace
App Version: 4.3.1
App Version Code: 40030192
App Flavor: play
Files App Version Code: 30300890 (PROD)
---
OS Version: 6.1.75-android14-11-o-g4c9c8979e2a7(U.R4T2.1bb3b3f_1-22c9a)
OS API Level: 35
Device: OP5E93L1
Manufacturer: OnePlus
Model (and Product): CPH2663 (CPH2663EEA)
---
java.lang.Exception: com.nextcloud.android.sso.exceptions.TokenMismatchException: Den afleverede godkendelsestoken stemmer ikke overens eller pakkenavnet er ikke tilladt for denne handling
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:164)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:100)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
java.lang.RuntimeException: com.nextcloud.android.sso.exceptions.TokenMismatchException: Den afleverede godkendelsestoken stemmer ikke overens eller pakkenavnet er ikke tilladt for denne handling
at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:46)
at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:93)
at io.reactivex.Maybe.blockingGet(Maybe.java:2321)
at io.reactivex.Observable.blockingSingle(Observable.java:5381)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pullRemoteChanges(NotesServerSyncTask.java:225)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:102)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Caused by: com.nextcloud.android.sso.exceptions.TokenMismatchException: Den afleverede godkendelsestoken stemmer ikke overens eller pakkenavnet er ikke tilladt for denne handling
at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:179)
at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:159)
at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0(NextcloudAPI.java:97)
at com.nextcloud.android.sso.api.NextcloudAPI.$r8$lambda$af7W9mq2B0ZrhVJwZd-ibFp8T3Y(Unknown Source:0)
at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda1.subscribe(D8$$SyntheticClass:0)
at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
at io.reactivex.Observable.subscribe(Observable.java:12284)
at io.reactivex.internal.operators.observable.ObservableSingleMaybe.subscribeActual(ObservableSingleMaybe.java:31)
at io.reactivex.Maybe.subscribe(Maybe.java:4290)
at io.reactivex.Maybe.blockingGet(Maybe.java:2320)
... 8 more
Now that's strange! Given you
have read the FAQ
it is a bit confusing for me that you
have removed and reinstalled the app without succes.
while the FAQ recommends you to
clear the storage of both, the Notes and the Nextcloud Android apps as described in the workarounds section.
Especially considering the emphasised warning in the workaround section that
⚠️ Uninstalling an app is not the same as clearing the storage, since Android keeps some data left on your device when uninstalling an app.
Are you absolutely sure your read the FAQ and acted as proposed?
I'm having the same issue of Sync Failed error message. I followed the Workaround instruction to clear cache/storage on the Nextcloud app as well. When Notes reinitializes, it successfully pulls all the notes from the server, but then always fails on subsequent sync attempts. The Webo Hosting Nextcloud support desk thought the issue is that I have over 200 notes, and the timeout setting in the Notes app is too low. I have no problem with Nextcloud Notes on the web with the PC browser (using Brave on Linux) and no problem with the notes in the Nextcloud app (Using Android 15).
The app error message is not the same as posted above though. Same issue on this Android 14 device was more convenient for me to post at the moment:
App Version: 4.3.1
App Version Code: 40030192
App Flavor: play
Files App Version Code: 30300890 (PROD)
---
OS Version: 4.19.294-ga7345195351d(2025021000)
OS API Level: 34
Device: barbet
Manufacturer: Google
Model (and Product): Pixel 5a (barbet)
---
java.lang.RuntimeException: com.nextcloud.android.sso.exceptions.UnknownErrorException: Read timed out
at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:46)
at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:93)
at io.reactivex.Maybe.blockingGet(Maybe.java:2321)
at io.reactivex.Observable.blockingSingle(Observable.java:5381)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pullRemoteChanges(NotesServerSyncTask.java:225)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:102)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Caused by: com.nextcloud.android.sso.exceptions.UnknownErrorException: Read timed out
at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:179)
at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:159)
at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0(NextcloudAPI.java:97)
at com.nextcloud.android.sso.api.NextcloudAPI.$r8$lambda$af7W9mq2B0ZrhVJwZd-ibFp8T3Y(Unknown Source:0)
at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda1.subscribe(D8$$SyntheticClass:0)
at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
at io.reactivex.Observable.subscribe(Observable.java:12284)
at io.reactivex.internal.operators.observable.ObservableSingleMaybe.subscribeActual(ObservableSingleMaybe.java:31)
at io.reactivex.Maybe.subscribe(Maybe.java:4290)
at io.reactivex.Maybe.blockingGet(Maybe.java:2320)
... 8 more
@PJK2011 your issue is unrelated to the error of the original issue author. Please open a separate issue, or even better search for existing issues. It is most likely a server setup issue in your case. There are various hints in closed issues how you can workaround your server timeouts, for example moving your issues step by step into your Notes folder.
I've got the same problem! So I don't post the message from Notes-App on Android dwevices, it is the same as above!
I have deleted the cache of the apps (Notes and NextCloud app) on all ( 4 Android devices). Unfortunately, that doesn't help.
A friend has now also installed Notes on his NextCloud server as a test. And then the app on a smartphone. Freshly installed - he also has the problem: No synchronization! So - it's certainly not due to any cache.
In the NextCloud App I can open and edit - and save - the notice as I want to do.
Any suggestions?
I was experiencing the same behavior. I had cleared cache and data from both apps, reinstalled, etc, with no changes.
However, I moved my Nextcloud installation from a hard disk array to an SSD array (same VM, same network, same compute resource). The only change was the storage location of the VM.
Synchronization started working again after that. I have about 2000 notes, as it's my quick reference on my phone. Even hosted on an enterprise SSD array, it still takes about 8 seconds to finish a sync.
Anecdotal, but perhaps server response time is at the root of this issue?
I've my installation on a professional server (ionos.com). And it was running for years... And I let the notes-App synch as long as it needed. (Until the error message came.)
Now that's strange! Given you
have read the FAQ
it is a bit confusing for me that you
have removed and reinstalled the app without succes.
while the FAQ recommends you to
clear the storage of both, the Notes and the Nextcloud Android apps as described in the workarounds section.
Especially considering the emphasised warning in the workaround section that
⚠️ Uninstalling an app is not the same as clearing the storage, since Android keeps some data left on your device when uninstalling an app.
Are you absolutely sure your read the FAQ and acted as proposed?
Sorry, but your snide comment wasn't helpful at all. The issue still remains.
Have a nice day.
The issue is usually caused by transfers, migrations, backup & restore (and similar) operations. The main Nextcloud app does not back up the tokens, they are therefore invalid after restoration. The Nextcloud SSO library does not yet provide an API to revalidate an existing token.
The only workaround is to clear the third party app's storage. If the same exception occurs again (and I mean the very same exception), then the app's storage was not cleared completely. Obviously. Really. Because hey - what else token should be invalid? Either there was some hacky whacky fancy tool involved to clear the storage instead of simply use the Androids native options or a backup was directly applied after clearing the storage or something else. I can't be more bold about the way to clear the storage, in the FAQ can even be read that uninstalling or clearing the cache is not the same.
A note about my "snide" comment
When there are FAQ that say exactly
clear the storage of both, the Notes and the Nextcloud Android apps
and then I read sentences like
I have removed and reinstalled the app without succes.
I have deleted the cache of the apps
that are so obvoiously not what can be read in the FAQ, then yes, this is not helpful either. Ticking the checkboxes while not actually performing the basic steps from a FAQ is disrespectful against community members trying to fix your environment in their free time. If the proposals didn't work out: Well, pity. But if someone tries to help you in his free time, you should at least do your part and read and execute an existing FAQ.
By the way. Searched for the exception yet? Yes, happens often, the reason was in the first paragraph of this comment. Plenty of issues, most of them "solved" by - you'll guess it - clearing the storage.
Have a nice day, too.
Sorry, to all who respond so sweetly for repeating myself.
- I have cleared ALL apps caches via the Android process. On a total of 4 devices. And get the message on all of them that synchronization does NOT work.
- A friend had NEVER installed a Notes app before. He has now done so - and the same problem. So: There can't be any data / tokens or whatever in the cache or wherever.
- So that no one who wants to help is unclear what I mean when I say: The Notes app reports after trying to synchronize:
Synchronization failed, more:
App Version: 4.3.1 App Version Code: 40030192 App Flavor: play
OS Version: 4.14.113-27209611(P615XXS9FXJ1) OS API Level: 33 Device: gta4xl Manufacturer: samsung Model (and Product): SM-P615 (gta4xleea)
java.lang.RuntimeException: com.nextcloud.android.sso.exceptions.NextcloudApiNotRespondingException: Die Nextcloud Files-App-API reagiert nicht. Dies ist höchstwahrscheinlich auf die Akkuoptimierungen Ihres Smartphones zurückzuführen. Versuchen Sie, die Batterieoptimierung für beide Apps (Nextcloud Files und diese App) zu deaktivieren. Ansonsten versuchen Sie bitte, den Speicher beider Apps zu löschen. at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:46) at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:93) at io.reactivex.Maybe.blockingGet(Maybe.java:2321) at io.reactivex.Observable.blockingSingle(Observable.java:5381) at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pullRemoteChanges(NotesServerSyncTask.java:225) at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:102) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012) Caused by: com.nextcloud.android.sso.exceptions.NextcloudApiNotRespondingException: Die Nextcloud Files-App-API reagiert nicht. Dies ist höchstwahrscheinlich auf die Akkuoptimierungen Ihres Smartphones zurückzuführen. Versuchen Sie, die Batterieoptimierung für beide Apps (Nextcloud Files und diese App) zu deaktivieren. Ansonsten versuchen Sie bitte, den Speicher beider Apps zu löschen. at com.nextcloud.android.sso.api.AidlNetworkRequest.waitForApi(AidlNetworkRequest.java:153) at com.nextcloud.android.sso.api.AidlNetworkRequest.performAidlNetworkRequestV2(AidlNetworkRequest.java:209) at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:171) at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:159) at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0(NextcloudAPI.java:97) at com.nextcloud.android.sso.api.NextcloudAPI.$r8$lambda$af7W9mq2B0ZrhVJwZd-ibFp8T3Y(Unknown Source:0) at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda1.subscribe(D8$$SyntheticClass:0) at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31) at io.reactivex.Observable.subscribe(Observable.java:12284) at io.reactivex.internal.operators.observable.ObservableSingleMaybe.subscribeActual(ObservableSingleMaybe.java:31) at io.reactivex.Maybe.subscribe(Maybe.java:4290) at io.reactivex.Maybe.blockingGet(Maybe.java:2320) ... 8 more
@C-Fuhrmann and one more time quoting myself because apparently you are not reading what other people answer:
and I mean the very same exception
You have an NextcloudApiNotRespondingException, this issue is about TokenMismatchException and at this point I am out because I am starting to take it personal otherwise. Honestly hope you find a solution that works out for you.
Thank you for the good wishes. I'm not sure if the comment about someone not reading everything is directed at me. But: If so, I'll try to reaffirm that I read everything and try to implement it as far as I can with my limited understanding.
I have:
- cleared all caches on the Androids - but that doesn't get me anywhere.
- copied the entire error message from my Androids here.
- also read that there is a NextcloudApiNotRespondingException, and also / or a TokenMismatchException is reported.
- opened the notes in the “normal” NextCloud app, wrote to them and saved them again. From this, I conclude that it is not due to the note content. And that an app can also log into NextCloud properly (Respond, Token, whatever). Only “Notes” hasn't been able to since the last update!
But: This is of no use to me. I would be happy if someone could tell me what to do and where. In particular, I wonder whether I need to delete anything anywhere on the NextCloud server. The “app” “Notes” on my server is version 4.11.0 and was last updated 6 months ago.
Translated with www.DeepL.com/Translator (free version)
I don't want to get caught in the crossfire, but I would still like to help solve the sync problems because I have been suffering from them for quite a while.
So I would like to ask both of you, @lmsoren and @C-Fuhrmann, about the version of your Nextcloud server installation, because I can't find that info in any of your posts. In my case the problem was solved by upgrading Nextcloud server from 23 to 31. Unfortunately I don't have any records about which of the two exceptions I had before.
I've Nextcloud Hub 9 (30.0.6) And the system itself sais: This is the aktual version! What is ver 31?
Ok - lession learned! The system itslf said: It is aktual version. But starting the updater he took me (no - NextCloud) to ver 31.0.0! Thanks!
But: The problem with "no synch" still remains....