Skip to content

Sync fails on duplicated http headers after upgrading to version 4.5.0 #2848

Closed

Description

@andrewille

This issue respects the following points:

Describe the bug

After I updated the Notes app from version 4.4.2 to 4.5.0, the synchronization is failing with an error. It turns out that it can no longer handle duplicated HTTP headers. But in the Nginx configuration from the documentation the header "X-Robots-Tag" is added twice. As a workaround, the header can be removed from the PHP response and readded just once. See my comment below.

Expected behavior

The app should properly handle duplicate headers, especially if they have the same value. And even if it does not, the App should not care about it at all.

Notes Android version

4.5.0

Notes server version

4.12.3

Nextcloud Android version

3.34.0

Nextcloud version

31.0.9

Device

Xiaomi Poco F3 (alioth)

Android Version

16

App Store

  • Google Play Store
  • F-Droid
  • Huawei App Gallery

Stacktrace

09-28 00:06:37.678 E/InputStreamBinder(31862): Error during Nextcloud request
09-28 00:06:37.678 E/InputStreamBinder(31862): java.lang.IllegalStateException: CE_5
09-28 00:06:37.678 E/InputStreamBinder(31862): 	at com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:440)
09-28 00:06:37.678 E/InputStreamBinder(31862): 	at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:113)
09-28 00:06:37.678 E/InputStreamBinder(31862): 	at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestV2(InputStreamBinder.java:96)
09-28 00:06:37.678 E/InputStreamBinder(31862): 	at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:108)
09-28 00:06:37.678 E/InputStreamBinder(31862): 	at android.os.Binder.execTransactInternal(Binder.java:1421)
09-28 00:06:37.678 E/InputStreamBinder(31862): 	at android.os.Binder.execTransact(Binder.java:1365)
09-28 00:06:37.678 E/InputStreamBinder(31862): Caused by: java.lang.IllegalStateException: 304
09-28 00:06:37.678 E/InputStreamBinder(31862): 	... 6 more
09-28 00:06:37.678 E/InputStreamBinder(31862): Caused by: java.lang.IllegalStateException: No response body
09-28 00:06:37.678 E/InputStreamBinder(31862): 	... 6 more
09-28 00:06:37.684 D/NotesServerSyncTask(28041): Server returned HTTP Status Code 304 - Notes not modified.
09-28 00:06:37.684 I/NotesServerSyncTask(28041): SYNCHRONIZATION FINISHED
09-28 00:06:37.684 E/com.nextcloud.android.sso.aidl.ParcelFileDescriptorUtil.TransferThread(31862): writing failed: write failed: EPIPE (Broken pipe)
09-28 00:06:37.684 D/InputStreamBinder(31862): Done sending result
09-28 00:06:37.684 E/NotesRepository(28041): Duplicate key X-Robots-Tag (attempted merging values noindex, nofollow and noindex, nofollow)[java.util.stream.Collectors.duplicateKeyException(Collectors.java:135), java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:182), java.util.stream.Collectors$$ExternalSyntheticLambda1.accept(D8$$SyntheticClass:0), java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169), java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1725), java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513), java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:503), java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921), java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:236), java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:705), com.nextcloud.android.sso.helper.Retrofit2Helper$1.lambda$execute$0(Retrofit2Helper.java:57), com.nextcloud.android.sso.helper.Retrofit2Helper$1$$ExternalSyntheticLambda2.apply(D8$$SyntheticClass:0), java.util.Optional.map(Optional.java:260), com.nextcloud.android.sso.helper.Retrofit2Helper$1.execute(Retrofit2Helper.java:55), it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:130), it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:99), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:524), java.util.concurrent.FutureTask.run(FutureTask.java:317), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651), java.lang.Thread.run(Thread.java:1119)]
09-28 00:06:37.684 E/NotesRepository(28041): java.lang.Exception: Duplicate key X-Robots-Tag (attempted merging values noindex, nofollow and noindex, nofollow)[java.util.stream.Collectors.duplicateKeyException(Collectors.java:135), java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:182), java.util.stream.Collectors$$ExternalSyntheticLambda1.accept(D8$$SyntheticClass:0), java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169), java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1725), java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513), java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:503), java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921), java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:236), java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:705), com.nextcloud.android.sso.helper.Retrofit2Helper$1.lambda$execute$0(Retrofit2Helper.java:57), com.nextcloud.android.sso.helper.Retrofit2Helper$1$$ExternalSyntheticLambda2.apply(D8$$SyntheticClass:0), java.util.Optional.map(Optional.java:260), com.nextcloud.android.sso.helper.Retrofit2Helper$1.execute(Retrofit2Helper.java:55), it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:130), it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:99), java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:524), java.util.concurrent.FutureTask.run(FutureTask.java:317), java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156), java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651), java.lang.Thread.run(Thread.java:1119)]
09-28 00:06:37.684 E/NotesRepository(28041): 	at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pushLocalChanges(NotesServerSyncTask.java:150)
09-28 00:06:37.684 E/NotesRepository(28041): 	at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:99)
09-28 00:06:37.684 E/NotesRepository(28041): 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:524)
09-28 00:06:37.684 E/NotesRepository(28041): 	at java.util.concurrent.FutureTask.run(FutureTask.java:317)
09-28 00:06:37.684 E/NotesRepository(28041): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
09-28 00:06:37.684 E/NotesRepository(28041): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
09-28 00:06:37.684 E/NotesRepository(28041): 	at java.lang.Thread.run(Thread.java:1119)

Activity

  1. xTGHHx commented on Sep 28, 2025

    @xTGHHx

    Same here!

  2. changed the title [-]Sync error on Android 16[/-] [+][Regression 4.5.0] Sync failing[/+] on Sep 29, 2025
  3. andrewille commented on Sep 29, 2025

    @andrewille
    Author

    Issue is not present on Notes release 4.4.2. Just download the older APK file from here, install it and do NOT update it until a fix is implemented.

  4. changed the title [-][Regression 4.5.0] Sync failing[/-] [+]Sync fails with "sync failed" error after upgrading to version 4.5.0[/+] on Sep 29, 2025
  5. realquink commented on Sep 30, 2025

    @realquink

    I also get the same issue with the new version.

  6. fdauti commented on Sep 30, 2025

    @fdauti

    Yep, same, going to the previous apk now

  7. changed the title [-]Sync fails with "sync failed" error after upgrading to version 4.5.0[/-] [+]Sync fails on duplicated http headers after upgrading to version 4.5.0[/+] on Sep 30, 2025
  8. andrewille commented on Sep 30, 2025

    @andrewille
    Author

    Quick update:
    As you could see in my stacktrace, it is caused by the duplicated HTTP header "X-Robots-Tag". I think this only affects nginx configurations since the default apache config (.htaccess) would drop these headers and then readd it just once. Obviously this is something that the notes app should be able to handle, but in the meantime you can also use this workaround if you host a Nextcloud instance that is used by others than you so they can keep using the newest App. We can just make nginx behave the same way and drop the multiple headers.

    Add the following one line to your nginx configuration:

    # add this line if you use FPM
    fastcgi_hide_header X-Robots-Tag;
    
    # add this line if you proxy to the inbuilt Apache server
    proxy_hide_header X-Robots-Tag;
    
    # this should have been in your config already
    add_header X-Robots-Tag                      "noindex, nofollow" always;
    
  9. rodrigoaguilera commented on Oct 1, 2025

    @rodrigoaguilera

    Great, removing the header made the sync work again.

    What is the other part in which the header is added? The PHP code?
    In that case the docs for nginx should be updated
    https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html

  10. skleber commented on Oct 2, 2025

    @skleber

    Same here too

  11. tm-107 commented on Oct 5, 2025

    @tm-107

    Quick update: As you could see in my stacktrace, it is caused by the duplicated HTTP header "X-Robots-Tag". I think this only affects nginx configurations since the default apache config (.htaccess) would drop these headers and then readd it just once. Obviously this is something that the notes app should be able to handle, but in the meantime you can also use this workaround if you host a Nextcloud instance that is used by others than you so they can keep using the newest App. We can just make nginx behave the same way and drop the multiple headers.

    ...

    Just did a fresh install with apache & nextcloud (both with default configs) ...
    -> "NoteDoesNotExistException Controller failed with OCA\Notes\Service\NoteDoesNotExistException Controller failed with OCA\Notes\Service\NoteDoesNotExistException"

    With the Notes app v4.4.2 on Android, everything is fine...

  12. 1 remaining item

  13. hpvb commented on Oct 7, 2025

    @hpvb

    Same problem and same solution here. I'm installing from f-droid if that matters.

    Rolling back to 4.4.2 solves the problem for me also.

  14. Croydon commented on Oct 8, 2025

    @Croydon

    Same problem and same solution here. I'm installing from f-droid if that matters.

    Rolling back to 4.4.2 solves the problem for me also.

    Same for me.

    Seems like Notes has multiple problems with HTTP headers. I can't find the related issues anymore, but there is one, that Notes is case-sensitive when it comes to HTTP headers, which according to spec they should be treated case insensitive. Which causes that Notes is downloading all notes again, if the timestamp (?) HTTP headers are in another casing then the expected one.

    So, Notes needs probably in general a more robust HTTP header handling.

    Edit: Found it: #2531

  15. Schneehexe commented on Oct 10, 2025

    @Schneehexe

    Same problem and solution here. Install from f-droid.

    I made a Rollback to 4.4.2, so it do well again.

  16. alperozturk96 commented on Oct 13, 2025

    @alperozturk96
    Collaborator

    @andrewille

    Hello.

    It appears that the issue originates from the SingleSignOn library version used in the Notes app v4.5.0.
    I’ve submitted a pull request to address the problem, and the change is included in this QA version.

    Could you please test it and let us know if the issue is resolved?

    Thank you.

  17. korelstar commented on Oct 13, 2025

    @korelstar
    Member

    @alperozturk96 : I've tested your fix nextcloud/Android-SingleSignOn#907 and it works for me! Thank you very much!

  18. linked a pull request that will close this issuechore: update single sign on lib #2876on Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions