mem0ai/mem0 · error · Error
${context} failed in Neptune Analytics
Error message
${context} failed in Neptune Analytics What it means
Neptune Analytics batch queries return per-record success flags rather than failing the whole statement. After each batch operation the store scans the result records and throws if any record reports success !== true, converting a partial failure into a visible error instead of silently dropping rows.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/neptune_analytics.ts:1030
return undefined;
}
const numericScore = Number(score);
if (!Number.isFinite(numericScore)) {
return undefined;
}
// Neptune returns squared Euclidean distance, while Memory search expects higher-is-better scores.
return 1 / (1 + Math.max(0, numericScore));
}
private assertSuccessfulResults(
results: NeptuneQueryRecord[],
context: string,
): void {
for (const record of results) {
if ("success" in record && record.success !== true) {
throw new Error(`${context} failed in Neptune Analytics`);
}
}
}
/**
* Load the optional AWS SDK on first use.
*
* This MUST be a dynamic `import()`, never `require()`: tsup/esbuild rewrite
* `require()` in the published ESM bundle (`dist/oss/index.mjs`) into a
* `__require` shim that throws `Dynamic require of "..." is not supported`,
* so every ESM consumer would hit a dead provider even with the SDK installed.
*/
private async getSDK(): Promise<NeptuneSDK> {
if (!this.sdkPromise) {
this.sdkPromise = import("@aws-sdk/client-neptune-graph").then(
(sdk) => sdk as unknown as NeptuneSDK,
(err) => {
// Let a later call retry rather than caching the rejection forever.View on GitHub (pinned to 001c235229)
Solutions
- Log the failing batch's inputs and retry only the failed records (the batch is partially applied).
- Reduce batch size to isolate the offending record and inspect it for malformed IDs or values.
- Check AWS CloudWatch logs for the Neptune Analytics graph to see the per-record failure reason.
Defensive patterns
Strategy: retry
Try / catch
try {
await store.insert(vectors, ids, payloads);
} catch (e) {
if (e instanceof Error && e.message.includes('failed in Neptune Analytics')) {
// batch is partially applied: reconcile ids then retry the missing ones
const existing = new Set(await listExistingIds(ids));
const retryIds = ids.filter((id) => !existing.has(id));
await retryInsert(retryIds);
} else throw e;
} Prevention
- Keep batches small so partial failures are cheap to reconcile
- Make writes idempotent (stable record IDs)
- Check record-level success flags in AWS CloudWatch during bulk loads
When it happens
Trigger: Batch insert/update/delete where at least one record fails server-side — e.g. a vertex write rejected due to schema, throttling, or an invalid ID — while the HTTP call itself returned 200.
Common situations: Large bulk imports that partially succeed; concurrent writers causing throttling; malformed individual records (too-long IDs, type mismatches) inside an otherwise valid batch.
Related errors
- Failed to delete ${entity.type} ${entity.name}: ${error.mess
- AWS Bedrock requires both awsAccessKeyId and awsSecretAccess
- Error getting embedding from AWS Bedrock model ${this.model}
- AWS Bedrock model ${this.model} returned no embedding for on
- OpenAI embedBatch() returned ${allEmbeddings.length} embeddi
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/adb111717a85e03a.
Report an issue: GitHub.