{"record":{"id":"dd8e97d3947849df","repo":"mem0ai/mem0","slug":"either-contact-points-or-secure-connect-bundle","errorCode":null,"errorMessage":"Either 'contact_points' or 'secure_connect_bundle' must be provided","messagePattern":"Either 'contact_points' or 'secure_connect_bundle' must be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/configs/vector_stores/cassandra.py","lineNumber":53,"sourceCode":"\n        # Both username and password must be provided together or not at all\n        if (username and not password) or (password and not username):\n            raise ValueError(\n                \"Both 'username' and 'password' must be provided together for authentication\"\n            )\n\n        return values\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def check_connection_config(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        \"\"\"Validate connection configuration.\"\"\"\n        secure_connect_bundle = values.get(\"secure_connect_bundle\")\n        contact_points = values.get(\"contact_points\")\n\n        # Either secure_connect_bundle or contact_points must be provided\n        if not secure_connect_bundle and not contact_points:\n            raise ValueError(\n                \"Either 'contact_points' or 'secure_connect_bundle' must be provided\"\n            )\n\n        return values\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        \"\"\"Validate that no extra fields are provided.\"\"\"\n        allowed_fields = set(cls.model_fields.keys())\n        input_fields = set(values.keys())\n        extra_fields = input_fields - allowed_fields\n\n        if extra_fields:\n            raise ValueError(\n                f\"Extra fields not allowed: {', '.join(extra_fields)}. \"\n                f\"Please input only the following fields: {', '.join(allowed_fields)}\"\n            )","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/cassandra.py#L35-L71","documentation":"Raised by the Cassandra config validator when no connection endpoint is given. Mem0 needs either an explicit list of contact_points (direct cluster addresses) or a secure_connect_bundle (zip from Astra/DataStax cloud) to establish a session; neither means the client has nowhere to connect.","triggerScenarios":"Instantiating CassandraConfig with neither 'contact_points' nor 'secure_connect_bundle' keys, or with both set to None/empty. Everything else (keyspace, auth) can be correct and this still fires first.","commonSituations":"Forgetting the bundle path when moving from local Cassandra to DataStax Astra; the secure_connect_bundle path string being consumed but the key named differently ('bundle_path'); configs built dynamically where the endpoint section is conditionally omitted.","solutions":["Set 'contact_points' to a list of cluster node hosts for self-hosted Cassandra","Or set 'secure_connect_bundle' to the path of the Astra/DataStax secure bundle zip","Verify the key that populates the endpoint is actually present at config-build time (assert before constructing)","For Astra, download the bundle fresh if the path variable points to a file that no longer exists"],"exampleFix":"# before\nCassandraConfig(keyspace=\"mem0\", username=\"u\", password=\"p\")\n\n# after\nCassandraConfig(contact_points=[\"127.0.0.1\"], keyspace=\"mem0\", username=\"u\", password=\"p\")","handlingStrategy":"validation","validationCode":"def validate_cassandra_endpoint(cfg: dict) -> None:\n    if not cfg.get(\"secure_connect_bundle\") and not cfg.get(\"contact_points\"):\n        raise RuntimeError(\"Cassandra config needs 'contact_points' or 'secure_connect_bundle'\")","typeGuard":"def has_cassandra_endpoint(cfg: dict) -> bool:\n    return bool(cfg.get(\"secure_connect_bundle\") or cfg.get(\"contact_points\"))","tryCatchPattern":"from pydantic import ValidationError\ntry:\n    CassandraConfig(**cfg)\nexcept ValidationError as e:\n    if \"secure_connect_bundle\" in str(e):\n        # set contact_points or the bundle path, then retry\n        ...","preventionTips":["Assert the endpoint key exists before constructing the config","For Astra, verify the bundle file path resolves before config build","Keep a per-environment endpoint template (local: contact_points, cloud: bundle)"],"tags":["pydantic","configuration","vector-store","cassandra","connection"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}