mem0ai/mem0 · error · ValueError

Either 'contact_points' or 'secure_connect_bundle' must be p

Error message

Either 'contact_points' or 'secure_connect_bundle' must be provided

What it means

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.

Source

Thrown at mem0/configs/vector_stores/cassandra.py:53

        # Both username and password must be provided together or not at all
        if (username and not password) or (password and not username):
            raise ValueError(
                "Both 'username' and 'password' must be provided together for authentication"
            )

        return values

    @model_validator(mode="before")
    @classmethod
    def check_connection_config(cls, values: Dict[str, Any]) -> Dict[str, Any]:
        """Validate connection configuration."""
        secure_connect_bundle = values.get("secure_connect_bundle")
        contact_points = values.get("contact_points")

        # Either secure_connect_bundle or contact_points must be provided
        if not secure_connect_bundle and not contact_points:
            raise ValueError(
                "Either 'contact_points' or 'secure_connect_bundle' must be provided"
            )

        return values

    @model_validator(mode="before")
    @classmethod
    def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:
        """Validate that no extra fields are provided."""
        allowed_fields = set(cls.model_fields.keys())
        input_fields = set(values.keys())
        extra_fields = input_fields - allowed_fields

        if extra_fields:
            raise ValueError(
                f"Extra fields not allowed: {', '.join(extra_fields)}. "
                f"Please input only the following fields: {', '.join(allowed_fields)}"
            )

View on GitHub (pinned to 001c235229)

Solutions

  1. Set 'contact_points' to a list of cluster node hosts for self-hosted Cassandra
  2. Or set 'secure_connect_bundle' to the path of the Astra/DataStax secure bundle zip
  3. Verify the key that populates the endpoint is actually present at config-build time (assert before constructing)
  4. For Astra, download the bundle fresh if the path variable points to a file that no longer exists

Example fix

# before
CassandraConfig(keyspace="mem0", username="u", password="p")

# after
CassandraConfig(contact_points=["127.0.0.1"], keyspace="mem0", username="u", password="p")
Defensive patterns

Strategy: validation

Validate before calling

def validate_cassandra_endpoint(cfg: dict) -> None:
    if not cfg.get("secure_connect_bundle") and not cfg.get("contact_points"):
        raise RuntimeError("Cassandra config needs 'contact_points' or 'secure_connect_bundle'")

Type guard

def has_cassandra_endpoint(cfg: dict) -> bool:
    return bool(cfg.get("secure_connect_bundle") or cfg.get("contact_points"))

Try / catch

from pydantic import ValidationError
try:
    CassandraConfig(**cfg)
except ValidationError as e:
    if "secure_connect_bundle" in str(e):
        # set contact_points or the bundle path, then retry
        ...

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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