diff --git a/hindsight-api/hindsight_api/engine/memory_engine.py b/hindsight-api/hindsight_api/engine/memory_engine.py index 5ec6483b..ef63e175 100644 --- a/hindsight-api/hindsight_api/engine/memory_engine.py +++ b/hindsight-api/hindsight_api/engine/memory_engine.py @@ -1689,6 +1689,8 @@ class MemoryEngine: """ pool = await self._get_pool() async with acquire_with_retry(pool) as conn: + # Ensure connection is not in read-only mode (can happen with connection poolers) + await conn.execute("SET SESSION CHARACTERISTICS AS TRANSACTION READ WRITE") async with conn.transaction(): try: if fact_type: