Error: Node model already contains property

I'm using Quarkus with Neo4j-OGM to store Maven-Data gathered within a Jenkins-Run (the maven-plugin gathers data sends it via REST to the Quarkus service, which writes to Neo4j).

Quarkus 1.10.3.Final
neo4j-ogm Driver 3.2.11
Neo4j DB 3.5.14

Lately I see exceptions like below in the log, and I was wondering how this comes. (Google didn't bring up anything.)
The error + log is from my PROD environment, and comes up again everytime I re-run the case. On the other hand it works in my DEV-environment, and other (similar) components work in PROD, too. (However, there are lots of such errors)

Any ideas, what the problem could be and how to fix it?

Many thanks in advance!

2021-06-09 00:19:20,711 ERROR [...MavenComponentService] (executor-thread-1) Error saving component xxx:xxx-services-model: org.neo4j.ogm.exception.core.MappingException: Node model already contains property: groupId
	at java.util.HashMap.forEach(
	at org.neo4j.ogm.context.EntityGraphMapper.updateFieldsOnBuilder(
	at org.neo4j.ogm.context.EntityGraphMapper.updateNode(
	at org.neo4j.ogm.context.EntityGraphMapper.mapEntity(
	at org.neo4j.ogm.context.EntityGraphMapper.mapRelatedEntity(
	at org.neo4j.ogm.context.EntityGraphMapper.mapEntityReferences(
	at org.neo4j.ogm.context.EntityGraphMapper.mapEntity(
	at org.neo4j.ogm.session.delegates.SaveDelegate.lambda$save$0(
	at java.util.Collections$SingletonList.forEach(

It seems that the CompositeAttributeConverter you are using for a particular field returns a Map containing the groupId key. But this property is already defined on the node itself.
Without code this is of course just a wild guess I can make for now.

Thank you, @gerrit.meier, for your reply!

I had the same idea, so I activated debug logging in DEV where I could not find any suspicious property (and no error occured there).
So... I will try to get a grasp on the data in my Openshift Environment to debug it locally.

OK, I managed to download the database-files and debug locally.

It seems, Neo4j wants to save the entity n, which has a relation to a parent: (n:MavenComponent) -[:PARENT]-> (p:MavenComponent).
The error occurs when trying to save the related entities of n, which is: p.

The parent p already exists in the DB, and should be known within the session-context - I fetch such related nodes specifically to prevent updates on already known entities (= those found in DB).

I debugged it, and stoped at this line where Neo4j tries to map already existing properties to the parent node p:

at org.neo4j.ogm.context.EntityGraphMapper.updateNode(

At this breakpoint I can see the clash of existing node-properties and my additional properties - which are the same.

Now the weird stuff: when I manually delete the parent node p from the DB, and rerun my tests, there is no problem at all. The parent node p gets created again (because of the maven structure). And I can do several subsequent runs, without any problem!

I can even change properties - no effect.
However, when I change relations on the parent node (manually, or by code), the same error occours.

Any ideas why?

Some more context:

  • I'm using a custom property converter for additional properties, like that: @Convert(NoPrefixPropertiesConverter.class) private Map<String, String> properties = new HashMap<>();
  • I'm using a custom id, which is a string value (concatenated GAV values, Maven style)
  • I'm using an event-listener add/update a timestamp property onPreSave(), which I register like that: sessionFactory.register(new AddTimestampEventListener());

Finally fixed the bug.

Removed @Convert(NoPrefixPropertiesConverter.class) and replaced with @Properties(prefix = "aux", delimiter = ":")
This, and some other, smaller changes to be more standard-compliant.

Main issue with the NoPrefixPropertiesConverter was in the context of relations - Neo4j (or OGM) seems to update the related Node, when changing the relation (even when the node itself is not touched), and that somehow doesn't cope well with the above mentioned properties converter.

1 Like