mem0ai/mem0 · critical · Error
The '@aws-sdk/client-neptune-graph' package is required to u
Error message
The '@aws-sdk/client-neptune-graph' package is required to use the Neptune Analytics vector store. Install it with: npm install @aws-sdk/client-neptune-graph (original error: ${detail}) What it means
The Neptune Analytics store lazy-imports @aws-sdk/client-neptune-graph on first use so the SDK stays an optional peer dependency. If the dynamic import fails (package not installed, or bundler could not resolve it), the store wraps the failure with install instructions and the original error, and clears the memoized promise so a later call can retry after the user installs the package.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/neptune_analytics.ts:1051
}
/**
* 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.
this.sdkPromise = undefined;
const detail = err instanceof Error ? err.message : String(err);
throw new Error(
"The '@aws-sdk/client-neptune-graph' package is required to use the Neptune Analytics vector store. " +
`Install it with: npm install @aws-sdk/client-neptune-graph (original error: ${detail})`,
);
},
);
}
return this.sdkPromise;
}
/** Memoized Neptune client; an injected `config.client` short-circuits the SDK. */
private async getClient(): Promise<NeptuneGraphClientLike> {
if (this.clientOverride) return this.clientOverride;
if (!this.clientPromise) {
this.clientPromise = this.getSDK()
.then(
({ NeptuneGraphClient }) => new NeptuneGraphClient(this.clientConfig),
)
.catch((err) => {View on GitHub (pinned to 001c235229)
Solutions
- Run: npm install @aws-sdk/client-neptune-graph (or pnpm add / yarn add).
- If already installed, verify it resolves from the project running mem0 (check node_modules, workspace hoisting) and reinstall in the correct package.
- For bundlers, mark @aws-sdk/client-neptune-graph as external so the runtime import succeeds.
Example fix
# before npm install mem0ai # NeptuneAnalytics store throws on first query # after npm install mem0ai @aws-sdk/client-neptune-graph
Defensive patterns
Strategy: try-catch
Validate before calling
try {
await import('@aws-sdk/client-neptune-graph');
} catch {
throw new Error('Install @aws-sdk/client-neptune-graph before using the Neptune store');
} Try / catch
try { await store.search(q); } catch (e) { if (e.message.includes("'@aws-sdk/client-neptune-graph' package is required")) { await installOrAbort(); } throw e; } Prevention
- Add @aws-sdk/client-neptune-graph as an explicit dependency when using this store
- Smoke-test the store at startup with a trivial query
- Mark the SDK external in bundler configs
When it happens
Trigger: Using the Neptune Analytics vector store without @aws-sdk/client-neptune-graph installed; bundling with esbuild/webpack in a setup that cannot resolve the optional dependency; monorepo hoisting issues where the package is present in a different workspace.
Common situations: Installing mem0ai with a package manager that skips optional peers; tree-shaking/bundling for serverless (Lambda) that drops the optional import; adding the Neptune store to an existing project and forgetting the AWS SDK dependency.
Related errors
- The '@aws-sdk/client-s3vectors' package is required to use t
- The '@zilliz/milvus2-sdk-node' package is required to use th
- The '@aws-sdk/client-bedrock-runtime' package is required to
- The '@databricks/sql' package is required to use the Databri
- Neptune Analytics list filters do not support case-insensiti
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/5ac47ca60b1578ab.
Report an issue: GitHub.