mem0ai/mem0 · critical · Error

vectorBucketName is required

Error message

vectorBucketName is required

What it means

The S3 Vectors vector store requires an existing S3 Vectors bucket name at construction. Unlike some other stores, it cannot derive or create one, so a missing/falsy vectorBucketName fails fast in the constructor.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/s3_vectors.ts:49

interface S3VectorsClientLike {
  send(command: any): Promise<any>;
}

export class S3Vectors implements VectorStore {
  private readonly config: S3VectorsConfig;
  private readonly vectorBucketName: string;
  private readonly collectionName: string;
  private readonly dimension: number;
  private readonly distanceMetric: "cosine" | "euclidean";
  private client?: S3VectorsClientLike;
  private clientPromise?: Promise<S3VectorsClientLike>;
  private sdkPromise?: Promise<any>;
  private _initPromise?: Promise<void>;
  private cachedUserId?: string;

  constructor(config: S3VectorsConfig) {
    if (!config.vectorBucketName) {
      throw new Error("vectorBucketName is required");
    }
    if (!config.collectionName) {
      throw new Error("collectionName is required");
    }

    const dimension = config.embeddingModelDims ?? config.dimension;
    if (!dimension || dimension < 1) {
      throw new Error("embeddingModelDims or dimension is required");
    }

    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);
  }

View on GitHub (pinned to 001c235229)

Solutions

  1. Create an S3 Vectors bucket in AWS (aws s3vectors create-vector-bucket --vector-bucket-name my-bucket) and pass its name in config
  2. Load the bucket name from environment/SSM and verify it is non-empty before constructing the store
  3. Check for typos in the config key — it must be exactly vectorBucketName

Example fix

// before
const vs = new S3Vectors({ collectionName: 'memories', dimension: 1536 });

// after
const vs = new S3Vectors({
  vectorBucketName: process.env.S3_VECTORS_BUCKET!,
  collectionName: 'memories',
  dimension: 1536,
});
Defensive patterns

Strategy: validation

Validate before calling

function assertS3VectorsConfig(c: any): void {
  if (!c?.vectorBucketName) throw new Error('vectorBucketName is required');
}
assertS3VectorsConfig(config);

Type guard

const hasBucket = (c: any): c is { vectorBucketName: string } =>
  typeof c?.vectorBucketName === 'string' && c.vectorBucketName.length > 0;

Try / catch

try { const vs = new S3Vectors(config); } catch (e) { if (e instanceof Error && e.message === 'vectorBucketName is required') { /* provision bucket or fix env, not retryable */ } throw e; }

Prevention

When it happens

Trigger: new S3Vectors({ collectionName: 'x', dimension: 1536 }) with no vectorBucketName; config read from env vars where S3_VECTORS_BUCKET is unset; empty string passed for the bucket.

Common situations: New integration setup where the bucket was created in AWS console but the name was never wired into config; env var name typo; deploying without the bucket provisioned via IaC.

Related errors


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