mem0ai/mem0 · error · Error

Cassandra vector store requires localDataCenter when secureC

Error message

Cassandra vector store requires localDataCenter when secureConnectBundle is not provided.

What it means

The cassandra-driver requires a localDataCenter (a.k.a. load-balancing DC) when connecting directly to a cluster without a cloud bundle. createClient() enforces this right after the contactPoints check, so direct connections fail fast at client creation when it is absent.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/cassandra.ts:346

    );
  }

  private async createClient(): Promise<CassandraClientLike> {
    const driver = this.driver ?? (await this.loadDriver());
    const clientConfig: Record<string, any> = {};

    if (this.secureConnectBundle) {
      clientConfig.cloud = {
        secureConnectBundle: this.secureConnectBundle,
      };
    } else {
      if (!this.contactPoints || this.contactPoints.length === 0) {
        throw new Error(
          "Cassandra vector store requires contactPoints when secureConnectBundle is not provided.",
        );
      }
      if (!this.localDataCenter) {
        throw new Error(
          "Cassandra vector store requires localDataCenter when secureConnectBundle is not provided.",
        );
      }
      clientConfig.contactPoints = this.contactPoints;
      clientConfig.localDataCenter = this.localDataCenter;
      clientConfig.protocolOptions = {
        port: this.port,
      };
    }

    if (this.protocolVersion !== undefined) {
      clientConfig.protocolOptions = {
        ...(clientConfig.protocolOptions || {}),
        maxVersion: this.protocolVersion,
      };
    }
    if (this.loadBalancingPolicy) {
      clientConfig.policies = {

View on GitHub (pinned to 001c235229)

Solutions

  1. Set localDataCenter in the config to your cluster's DC name — 'datacenter1' for a default single-node install
  2. Find the DC name with nodetool status or cqlsh 'DESCRIBE CLUSTER' if unsure
  3. If using Astra, switch to secureConnectBundle which removes the localDataCenter requirement

Example fix

// before
new Cassandra({ contactPoints: ['127.0.0.1'], collectionName: 'mem' });

// after
new Cassandra({
  contactPoints: ['127.0.0.1'],
  localDataCenter: 'datacenter1',
  collectionName: 'mem',
});
Defensive patterns

Strategy: validation

Validate before calling

function assertCassandraDc(config: any) {
  if (!config.secureConnectBundle && !config.localDataCenter) {
    throw new Error('Missing localDataCenter (default single-node: datacenter1)');
  }
}

Try / catch

try { const store = new Cassandra(cfg); } catch (e) { if (e instanceof Error && e.message.includes('localDataCenter')) { cfg.localDataCenter = 'datacenter1'; } throw e; }

Prevention

When it happens

Trigger: Configuring the Cassandra store with contactPoints but no localDataCenter and no secureConnectBundle. The contactPoints check passes, then this error is thrown on the next line.

Common situations: Default single-node Cassandra installs use 'datacenter1' and devs omit the field; multi-DC clusters where the correct DC name (e.g. 'us-east', 'dc1') is not obvious; migrating an Astra config (which needs no localDataCenter) to self-hosted.

Related errors


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