This commit is contained in:
donbr 2025-12-10 11:22:07 -08:00 committed by GitHub
commit 5a17d10ad4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -278,8 +278,18 @@ class GraphitiService:
# Re-raise other errors # Re-raise other errors
raise raise
# Build indices # Build indices - wrap in try/except to handle Neo4j 5.x race condition
await self.client.build_indices_and_constraints() # with parallel IF NOT EXISTS index creation
try:
await self.client.build_indices_and_constraints()
except Exception as idx_error:
if 'EquivalentSchemaRuleAlreadyExists' in str(idx_error):
logger.warning(
'Index creation race condition detected (Neo4j 5.x issue). '
'Indexes likely already exist. Continuing...'
)
else:
raise
logger.info('Successfully initialized Graphiti client') logger.info('Successfully initialized Graphiti client')