mem0ai/mem0 · error · RuntimeError

Neptune Analytics update upsert reported failure for {vector

Error message

Neptune Analytics update upsert reported failure for {vector_id}

What it means

Neptune Analytics update() first rewrites node properties, then upserts the new embedding; the openCypher vectors.upsert call returns a per-row success flag. If the service acknowledges the query but reports success:false (throttling, transient graph state), this RuntimeError fires and the except branch rolls the node properties back to their prior state, keeping payload and embedding consistent.

Source

Thrown at mem0/vector_stores/neptune_analytics.py:286

                "vector_id": vector_id
            }
            query_string_embedding = f"""
            MATCH (n :{self.collection_name})
                WHERE id(n) = $vector_id
            WITH $embedding as embedding, n as n
            CALL neptune.algo.vectors.upsert(n, embedding)
            YIELD success
            RETURN success
            """
            try:
                result = self.execute_query(query_string_embedding, para_embedding)
                # A soft {"success": False} row desyncs the payload from the embedding just as
                # much as a thrown error, so treat it as a failure and let the rollback below fire.
                # Mirrors the TS store's assertSuccessfulResults() check (Python's
                # _process_success_message only logs, so it cannot drive the rollback).
                for row in result or []:
                    if "success" in row and row["success"] is not True:
                        raise RuntimeError(f"Neptune Analytics update upsert reported failure for {vector_id}")
            except Exception:
                if prior_properties is not None:
                    try:
                        restore_query = f"""
                        MATCH (n :{self.collection_name})
                            WHERE id(n) = $vector_id
                            SET n = $properties
                        """
                        self.execute_query(
                            restore_query,
                            {"properties": prior_properties, "vector_id": vector_id},
                        )
                    except Exception:
                        logger.error(
                            f"Neptune Analytics: failed to restore prior payload for {vector_id} "
                            "after a failed vector upsert"
                        )
                raise

View on GitHub (pinned to 001c235229)

Solutions

  1. Catch RuntimeError/Exception around the update and retry with backoff — the store already restored the old properties, so a retry is safe
  2. Reduce update concurrency against the graph (batch/queue updates)
  3. Check the graph status and server-side metrics (throttle exceptions) with aws neptune-graph get-graph
  4. If persistent, open an AWS support case with the graph ID and timestamp

Example fix

# before
store.update(vid, vector=v, payload=p)

# after
for attempt in range(3):
    try:
        store.update(vid, vector=v, payload=p)
        break
    except RuntimeError:
        time.sleep(2 ** attempt)
else:
    raise
Defensive patterns

Strategy: retry

Validate before calling

# no pre-check prevents a server-side soft failure; verify graph is available first
import boto3
sts = boto3.client("neptune-graph")
state = sts.get_graph(graphIdentifier=GRAPH_ID)["status"]
if state != "AVAILABLE":
    raise RuntimeError(f"graph not available: {state}")

Try / catch

for attempt in range(4):
    try:
        store.update(vector_id=vid, vector=v, payload=p)
        break
    except RuntimeError as e:
        if "upsert reported failure" in str(e) and attempt < 3:
            time.sleep(2 ** attempt)  # properties were rolled back; safe to retry
            continue
        raise

Prevention

When it happens

Trigger: Neptune Analytics returning {success: false} from CALL neptune.algo.vectors.upsert during update(vector_id, vector, payload); commonly under server-side throttling, capacity limits, or a graph in a mutating/resizing state.

Common situations: Bulk memory updates hitting vector-upsert throughput limits; graph maintenance windows; intermittent failures that a plain error-based check would have silently swallowed (the code treats soft-failure as hard failure deliberately).

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/549fbc3af7aa1838. Report an issue: GitHub.