{"record":{"id":"853b5e2a6785e513","repo":"mem0ai/mem0","slug":"cassandra-vector-store-requires-localdatacenter-wh","errorCode":null,"errorMessage":"Cassandra vector store requires localDataCenter when secureConnectBundle is not provided.","messagePattern":"Cassandra vector store requires localDataCenter when secureConnectBundle is not provided\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/vector_stores/cassandra.ts","lineNumber":346,"sourceCode":"    );\n  }\n\n  private async createClient(): Promise<CassandraClientLike> {\n    const driver = this.driver ?? (await this.loadDriver());\n    const clientConfig: Record<string, any> = {};\n\n    if (this.secureConnectBundle) {\n      clientConfig.cloud = {\n        secureConnectBundle: this.secureConnectBundle,\n      };\n    } else {\n      if (!this.contactPoints || this.contactPoints.length === 0) {\n        throw new Error(\n          \"Cassandra vector store requires contactPoints when secureConnectBundle is not provided.\",\n        );\n      }\n      if (!this.localDataCenter) {\n        throw new Error(\n          \"Cassandra vector store requires localDataCenter when secureConnectBundle is not provided.\",\n        );\n      }\n      clientConfig.contactPoints = this.contactPoints;\n      clientConfig.localDataCenter = this.localDataCenter;\n      clientConfig.protocolOptions = {\n        port: this.port,\n      };\n    }\n\n    if (this.protocolVersion !== undefined) {\n      clientConfig.protocolOptions = {\n        ...(clientConfig.protocolOptions || {}),\n        maxVersion: this.protocolVersion,\n      };\n    }\n    if (this.loadBalancingPolicy) {\n      clientConfig.policies = {","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/cassandra.ts#L328-L364","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set localDataCenter in the config to your cluster's DC name — 'datacenter1' for a default single-node install","Find the DC name with nodetool status or cqlsh 'DESCRIBE CLUSTER' if unsure","If using Astra, switch to secureConnectBundle which removes the localDataCenter requirement"],"exampleFix":"// before\nnew Cassandra({ contactPoints: ['127.0.0.1'], collectionName: 'mem' });\n\n// after\nnew Cassandra({\n  contactPoints: ['127.0.0.1'],\n  localDataCenter: 'datacenter1',\n  collectionName: 'mem',\n});","handlingStrategy":"validation","validationCode":"function assertCassandraDc(config: any) {\n  if (!config.secureConnectBundle && !config.localDataCenter) {\n    throw new Error('Missing localDataCenter (default single-node: datacenter1)');\n  }\n}","typeGuard":null,"tryCatchPattern":"try { const store = new Cassandra(cfg); } catch (e) { if (e instanceof Error && e.message.includes('localDataCenter')) { cfg.localDataCenter = 'datacenter1'; } throw e; }","preventionTips":["Document 'datacenter1' as the default for single-node installs","Include localDataCenter in every shared config template for direct connections"],"tags":["cassandra","configuration","vector-store","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}