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 Baidu vector store config's strict extra-fields validator. Only keys matching declared model fields are accepted; anything else aborts validation with a message listing both the offending keys and the full allowed set. This is a closed-schema guard against typo'd or unsupported options.
Source
Thrown at mem0/configs/vector_stores/baidu.py:22
class BaiduDBConfig(BaseModel):
endpoint: str = Field("http://localhost:8287", description="Endpoint URL for Baidu VectorDB")
account: str = Field("root", description="Account for Baidu VectorDB")
api_key: str = Field(None, description="API Key for Baidu VectorDB")
database_name: str = Field("mem0", description="Name of the database")
table_name: str = Field("mem0", description="Name of the table")
embedding_model_dims: int = Field(1536, description="Dimensions of the embedding model")
metric_type: str = Field("L2", description="Metric type for similarity search")
@model_validator(mode="before")
@classmethod
def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:
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)}. 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
- Delete the extra key(s) named in the error
- Cross-check remaining keys against the allowed-fields list included in the error text
- Keep provider configs in separate dicts per provider rather than one shared dict passed everywhere
- After upgrading mem0, re-validate all vector store configs in a smoke test
Example fix
# before BaiduConfig(api_key="k", database_name="mem0", table_name="mem0", replica_count=3) # after BaiduConfig(api_key="k", database_name="mem0", table_name="mem0")
Defensive patterns
Strategy: validation
Validate before calling
from mem0.configs.vector_stores.baidu import BaiduConfig
def prune_baidu_extra(cfg: dict) -> dict:
extra = set(cfg) - set(BaiduConfig.model_fields)
if extra:
raise RuntimeError(f"Unexpected baidu keys: {sorted(extra)}")
return cfg Type guard
def baidu_keys_valid(cfg: dict) -> bool:
return not (set(cfg) - set(BaiduConfig.model_fields)) Try / catch
from pydantic import ValidationError
try:
BaiduConfig(**cfg)
except ValidationError as e:
if "Extra fields not allowed" in str(e):
# fix keys per the allowed list in the message
... Prevention
- Write provider-specific config dicts, never reuse another provider's
- Check the allowed-fields list printed in the error before retrying
- Pin mem0 version and store configs alongside the pin
When it happens
Trigger: Instantiating BaiduConfig with any key not in its declared fields (e.g. an unexpected 'region', 'timeout', or a field belonging to another vector store provider).
Common situations: Porting a config from another provider (qdrant, milvus) into the baidu section; using an option that was renamed or removed in a mem0 upgrade; hand-writing config dicts from memory instead of docs.
Related errors
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Extra fields not allowed: {', '.join(extra_fields)}. Please
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/7f6ed5d309ab2677.
Report an issue: GitHub.