Showing results for 
Search instead for 
Did you mean: 

SDN Neo4j 6.1.4 - Source emitted more than one item error



I'm running into an IndexOutOfBoundsException when calling the reactive template .save method using SDN 6.1.4. The stack trace points to the reactor flow in use here Flux.checkpoint ⇢ at The root issue appears to be Neo4j java entities that are annotated with the @Id and have duplicates in the db. I'm only populated the db using the neo4j reactive client, so I'm also puzzled as to how duplicates get there to begin with.

I'd love some help if possible. Thanks in advance!



If you populate the database with the (reactive) Neo4jClient, Spring Data Neo4j does not take the annotations of a model into consideration because it is a lower abstraction level than repositories or the Neo4jTemplate.
Basically the error message in your case is correct and cannot be worked around because there is an operation that expects to work with exactly one instance because of the (assumed) unique identifier and it fails because there are (already) duplicates.

Thanks for the quick reply @gerrit.meier. That makes sense that it can't be worked around, as it wouldn't know which node to update if the id was duplicated.

I still don't understand why the duplicates are appearing though. I'm only populating the graph using the .save method on a ReactiveNeo4jRepository, so no direct calls to Neo4jClient. Tracing through the spring data neo4j repository cypher generation code, it looks like it uses the @Id annotation, so shouldn't duplicates be prevented?
I'm considering adding a property constraint, but wondering if a constraint violation failure could occur on saving because of the same root issue.