nextcloud / nextcloud/notes-android
Synchronization failed: `llegalStateException: Duplicate key`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 168
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 31
Description
Please use GitHub reactions 👍 to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!
Describe the bug
Synchronization works initially, but then repeatedly fails. Rich text formatting seemed to initiate the issue, but I'm not sure.
My Nextcloud instance is up and running normally. I can access it via Android or a web browser.
To Reproduce
Steps to reproduce the behavior:
- Attempt any sync
- Receive 'Synchronization failed' message.
Expected behavior
Sync as any other app would.
App Version: 4.1.0
App Version Code: 40010090
App Flavor: play
Files App Version Code: 30260090 (PROD)
---
OS Version: 4.19.269-g7763b0d7bb61(2023100300)
OS API Level: 33
Device: barbet
Manufacturer: Google
Model (and Product): Pixel 5a (barbet)
---
java.lang.IllegalStateException: Duplicate key 590093 (attempted merging values 1 and 2)
at java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
at java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
at java.util.stream.Collectors$$ExternalSyntheticLambda39.accept(Unknown Source:6)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1390)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:475)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:236)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:517)
at it.niedermann.owncloud.notes.persistence.NotesRepository.getIdMap(NotesRepository.java:463)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.pullRemoteChanges(NotesServerSyncTask.java:208)
at it.niedermann.owncloud.notes.persistence.NotesServerSyncTask.run(NotesServerSyncTask.java:96)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting NotesRepository.getIdMap at line 463, then trace how NotesServerSyncTask.pullRemoteChanges at line 208 uses its result. Reproduce the failure by attempting a sync and determine why duplicate key 590093 reaches this path. Done means synchronization completes without the reported IllegalStateException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- databases, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100