mem0ai/mem0 · error · Error
The '@aws-sdk/client-s3vectors' package is required to use t
Error message
The '@aws-sdk/client-s3vectors' package is required to use the S3 Vectors store. Install it with: npm install @aws-sdk/client-s3vectors
What it means
@aws-sdk/client-s3vectors is an optional peer dependency, imported lazily so consumers not using the S3 Vectors store don't pay for it. If the import fails (package not installed), the store throws with the exact install command. This surfaces on the first store operation that needs the SDK, not at construction.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/s3_vectors.ts:76
}
this.config = config;
this.vectorBucketName = config.vectorBucketName;
this.collectionName = config.collectionName;
this.dimension = dimension;
this.distanceMetric = config.distanceMetric || "cosine";
void this.initialize().catch(console.error);
}
/**
* Lazily import the optional `@aws-sdk/client-s3vectors` peer so consumers
* who never use the S3 Vectors store don't need it installed.
*/
private getSdk(): Promise<any> {
if (!this.sdkPromise) {
this.sdkPromise = import("@aws-sdk/client-s3vectors").catch(() => {
throw new Error(
"The '@aws-sdk/client-s3vectors' package is required to use the S3 Vectors store. Install it with: npm install @aws-sdk/client-s3vectors",
);
});
}
return this.sdkPromise;
}
/** Lazily construct (or reuse) the S3 Vectors client. */
private async getClient(): Promise<S3VectorsClientLike> {
if (this.client) return this.client;
if (!this.clientPromise) {
this.clientPromise = this.createClient();
}
this.client = await this.clientPromise;
return this.client;
}
private async createClient(): Promise<S3VectorsClientLike> {View on GitHub (pinned to 001c235229)
Solutions
- npm install @aws-sdk/client-s3vectors (or pnpm add / yarn add) in the project using the S3 Vectors store
- Verify the package resolves at runtime: node -e "import('@aws-sdk/client-s3vectors').then(()=>console.log('ok'))"
- In bundled deployments, ensure the SDK is not marked external-and-absent — include it in the bundle or the image
Example fix
# before npm install mem0ai # s3 vectors unused dependency missing # after npm install mem0ai @aws-sdk/client-s3vectors
Defensive patterns
Strategy: validation
Validate before calling
async function assertS3VectorsSdk(): Promise<void> {
try { await import('@aws-sdk/client-s3vectors'); }
catch { throw new Error('Run: npm install @aws-sdk/client-s3vectors'); }
}
await assertS3VectorsSdk(); Try / catch
try { await s3vs.search(vec, {}); } catch (e) { if (e instanceof Error && e.message.includes('@aws-sdk/client-s3vectors')) { /* install dependency, redeploy */ } throw e; } Prevention
- Declare the SDK in dependencies (not merely hope the peer resolves) for any deployable using S3 Vectors
- Smoke-test the dynamic import in CI for the environment that uses this store
- Watch bundler configs that exclude optional peers from Lambda/Docker artifacts
When it happens
Trigger: Using S3Vectors without npm install @aws-sdk/client-s3vectors; a bundled deployment (Lambda layer, Docker image) where the optional dependency was tree-shaken or excluded from package.json installation; pnpm strict peer resolution skipping the optional package.
Common situations: CI installs with --omit=optional or production installs where the optional peer was never declared; monorepo hoisting issues; upgrading the store without re-reading the peer dependency list.
Related errors
- The '@zilliz/milvus2-sdk-node' package is required to use th
- The '@aws-sdk/client-neptune-graph' package is required to u
- The '@aws-sdk/client-bedrock-runtime' package is required to
- The '@databricks/sql' package is required to use the Databri
- vectorBucketName is required
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/5f7cbcff6621d211.
Report an issue: GitHub.