{"record":{"id":"5fb6909812464e6e","repo":"mem0ai/mem0","slug":"apache-cassandra-vector-store-requires-cassandra-d","errorCode":null,"errorMessage":"Apache Cassandra vector store requires cassandra-driver. Please install it using 'pip install cassandra-driver'","messagePattern":"Apache Cassandra vector store requires cassandra-driver\\. Please install it using 'pip install cassandra-driver'","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"critical","filePath":"mem0/vector_stores/cassandra.py","lineNumber":14,"sourceCode":"import json\nimport logging\nimport re\nimport uuid\nfrom typing import Any, Dict, List, Optional\n\nimport numpy as np\nfrom pydantic import BaseModel\n\ntry:\n    from cassandra.auth import PlainTextAuthProvider\n    from cassandra.cluster import Cluster\nexcept ImportError:\n    raise ImportError(\n        \"Apache Cassandra vector store requires cassandra-driver. \"\n        \"Please install it using 'pip install cassandra-driver'\"\n    )\n\nfrom mem0.vector_stores.base import VectorStoreBase\n\nlogger = logging.getLogger(__name__)\n\n_SAFE_IDENTIFIER_RE = re.compile(r'^[a-zA-Z_][a-zA-Z0-9_]{0,127}$')\n\n\ndef _validate_identifier(name: str, label: str = \"identifier\") -> str:\n    if not _SAFE_IDENTIFIER_RE.match(name):\n        raise ValueError(\n            f\"Invalid {label} '{name}': only letters, digits, and underscores are allowed, \"\n            \"must start with a letter or underscore, and be at most 128 characters.\"\n        )\n    return name","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/vector_stores/cassandra.py#L1-L32","documentation":"Module-level ImportError raised when 'cassandra-driver' is not installed. CassandraDB imports cassandra.auth.PlainTextAuthProvider and cassandra.cluster.Cluster at the top of mem0/vector_stores/cassandra.py; failure aborts the import of the whole module, so the class cannot even be referenced.","triggerScenarios":"Any import of mem0.vector_stores.cassandra or VectorStoreConfig(provider='cassandra') without cassandra-driver installed. Fires at import time, before any connection to the cluster is attempted.","commonSituations":"Choosing the Cassandra backend without adding the driver to the environment; CI smoke tests that iterate over all vector store modules; slim Docker images built from mem0ai core without extras.","solutions":["Install the driver: pip install cassandra-driver.","Remove the Cassandra import/config if the backend is not actually used.","Guard provider selection so the module is only imported when the driver is present."],"exampleFix":"# before\nfrom mem0.vector_stores.cassandra import CassandraDB  # ImportError\n\n# after\n# pip install cassandra-driver\nfrom mem0.vector_stores.cassandra import CassandraDB","handlingStrategy":"validation","validationCode":"try:\n    import cassandra  # noqa: F401\n    CASSANDRA_OK = True\nexcept ImportError:\n    CASSANDRA_OK = False\n\nif provider == \"cassandra\" and not CASSANDRA_OK:\n    raise SystemExit(\"cassandra-driver missing: pip install cassandra-driver\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install cassandra-driver as an explicit extra whenever the cassandra provider is configured.","Import provider modules lazily so one missing optional backend does not break unrelated code paths.","Include driver presence in deployment health checks."],"tags":["cassandra","dependencies","import-error","vector-store"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}