mem0ai/mem0 · error · ValueError
Extra fields not allowed: {', '.join(extra_fields)}. Please
Error message
Extra fields not allowed: {', '.join(extra_fields)}. Please input only the following fields: {', '.join(allowed_fields)} What it means
Raised by the Cassandra config's strict extra-fields validator. Any config key that is not a declared model field is rejected outright, with the error listing both the extras and the allowed fields. It is a typo/stale-option guard that runs before connection setup.
Source
Thrown at mem0/configs/vector_stores/cassandra.py:68
# 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)}"
)
return values
model_config = ConfigDict(arbitrary_types_allowed=True)
View on GitHub (pinned to 001c235229)
Solutions
- Remove the extra key(s) identified in the error message
- Map driver-level options to the supported fields; unsupported ones must be dropped
- Compare your key set with the allowed list embedded in the error output
- Keep configs version-pinned next to the mem0 release they were written for
Example fix
# before CassandraConfig(contact_points=["h"], protocol_version=4, keyspace="mem0") # after CassandraConfig(contact_points=["h"], keyspace="mem0")
Defensive patterns
Strategy: validation
Validate before calling
from mem0.configs.vector_stores.cassandra import CassandraConfig
def prune_cassandra_extra(cfg: dict) -> dict:
extra = set(cfg) - set(CassandraConfig.model_fields)
if extra:
raise RuntimeError(f"Unexpected cassandra keys: {sorted(extra)}")
return cfg Type guard
def cassandra_keys_valid(cfg: dict) -> bool:
return not (set(cfg) - set(CassandraConfig.model_fields)) Try / catch
from pydantic import ValidationError
try:
CassandraConfig(**cfg)
except ValidationError as e:
if "Extra fields not allowed" in str(e):
# remove driver-level kwargs listed in the message
... Prevention
- Do not pass raw cassandra-driver Cluster kwargs into mem0 config
- Maintain a mapping of supported fields per provider
- Re-run a config smoke test after mem0 upgrades
When it happens
Trigger: Passing CassandraConfig keys like 'hosts', 'port', 'protocol_version', or any option not in its declared field set — e.g. using driver-level keywords instead of the model's names.
Common situations: Translating a raw cassandra-driver Cluster() kwargs dict into mem0 config without pruning; carrying over fields from another vector store's config; fields removed during a mem0 version bump still present in saved configs.
Related errors
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Both 'username' and 'password' must be provided together for
- Either 'contact_points' or 'secure_connect_bundle' must be p
- Extra fields not allowed: {', '.join(extra_fields)}. Please
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/f0f172a3486e86fa.
Report an issue: GitHub.