Skip to content

IndexEntryConflictException with apoc.merge.node #558

Closed
@v2belleville

Description

@v2belleville

apoc.merge.node returns an IndexEntryConflictException (see full error output below)

(t:Tweet {id:"1652044756417912836"}) does exists in the database but it is not the first id in the file that is in the db. why this one triggers the errors is a mystery. tried several time, it is this id that triggers the error every time. If I suppress it another, id further down the file triggers the same error

I'm apparently not the only one who faced that error (https://stackoverflow.com/questions/67507411/facing-indexentryconflictexception-while-merging) .
Since I'm not sure which directories are mentioned in the SO answer (I use a Windows Desktop version of Neo4j),
I tried dropping and reconstructing constraint and indexes but problem remains the same...

UPDATE: I just realize that the use of apoc here was a leftover from a previous more complex version of the query. in this case, a simple merge works like a charm, but I guess the apoc issue is worth fixing anyway...

`File ~\Desktop\Python\myTwitterJsonImport2Neo4j.py:156, in importJsonTwLst(jsonTwLst, twExportDate, label, twOrigine, check, src)
149 #print(twLstNoNull)
151 query="""unwind $twLst as twJson
152 match (u:TwUser {id:twJson.userId})
153 call apoc.merge.node(['Tweet'],twJson) yield node
154 with twJson,u,node where not exists((u)-[:TWEETED]->(node))
155 create (u)-[:TWEETED {twExportDate:twJson.twExportDate, importDateTime:localdatetime({ timezone: 'Europe/Paris' })}]->(node)"""
--> 156 res=Neo.session.run(query,twLst=twLstNoNull)
157 print(res.consume().counters)
159 # creation des tw RT

File C:\Program Files\Python311\Lib\site-packages\neo4j_sync\work\session.py:311, in Session.run(self, query, parameters, **kwargs)
309 bookmarks = self._get_bookmarks()
310 parameters = dict(parameters or {}, **kwargs)
--> 311 self._auto_result._run(
312 query, parameters, self._config.database,
313 self._config.impersonated_user, self._config.default_access_mode,
314 bookmarks, self._config.notifications_min_severity,
315 self._config.notifications_disabled_categories,
316 )
318 return self._auto_result

File C:\Program Files\Python311\Lib\site-packages\neo4j_sync\work\result.py:166, in Result._run(self, query, parameters, db, imp_user, access_mode, bookmarks, notifications_min_severity, notifications_disabled_categories)
164 self._pull()
165 self._connection.send_all()
--> 166 self._attach()

File C:\Program Files\Python311\Lib\site-packages\neo4j_sync\work\result.py:274, in Result._attach(self)
272 if self._exhausted is False:
273 while self._attached is False:
--> 274 self._connection.fetch_message()

File C:\Program Files\Python311\Lib\site-packages\neo4j_sync\io_common.py:180, in ConnectionErrorHandler.getattr..outer..inner(*args, **kwargs)
178 def inner(*args, **kwargs):
179 try:
--> 180 func(*args, **kwargs)
181 except (Neo4jError, ServiceUnavailable, SessionExpired) as exc:
182 assert not asyncio.iscoroutinefunction(self.__on_error)

File C:\Program Files\Python311\Lib\site-packages\neo4j_sync\io_bolt.py:808, in Bolt.fetch_message(self)
804 # Receive exactly one message
805 tag, fields = self.inbox.pop(
806 hydration_hooks=self.responses[0].hydration_hooks
807 )
--> 808 res = self._process_message(tag, fields)
809 self.idle_since = perf_counter()
810 return res

File C:\Program Files\Python311\Lib\site-packages\neo4j_sync\io_bolt5.py:352, in Bolt5x0._process_message(self, tag, fields)
350 self._server_state_manager.state = self.server_states.FAILED
351 try:
--> 352 response.on_failure(summary_metadata or {})
353 except (ServiceUnavailable, DatabaseUnavailable):
354 if self.pool:

File C:\Program Files\Python311\Lib\site-packages\neo4j_sync\io_common.py:247, in Response.on_failure(self, metadata)
245 handler = self.handlers.get("on_summary")
246 Util.callback(handler)
--> 247 raise Neo4jError.hydrate(**metadata)

ClientError: {code: Neo.ClientError.Procedure.ProcedureCallFailed} {message: Failed to invoke procedure apoc.merge.node: Caused by: IndexEntryConflictException{propertyValues=( String("1652044756417912836") ), addedEntityId=-1, existingEntityId=2328}}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions