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 AzureMySQL config's strict extra-fields validator. The model computes set(keys) - set(model_fields) and rejects any key that is not a declared field, so the config acts as a closed schema. This catches typos and stale option names early instead of silently ignoring them.
Source
Thrown at mem0/configs/vector_stores/azure_mysql.py:90
if missing_fields:
raise ValueError(
f"Missing required fields: {', '.join(missing_fields)}. "
f"These fields are required when not using a pre-configured connection_pool."
)
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 or rename the extra field(s) listed in the error message so only declared fields remain
- Diff your config keys against the allowed list printed in the error message itself
- If the field is genuinely needed (e.g. port), wrap the connection in your own connection_pool instead of extending the model
- Pin the mem0 version and re-read that version's AzureMySQLConfig field list after upgrades
Example fix
# before AzureMySQLConfig(host="h", user="u", database="d", password="p", ssl_verify_cert=True) # after AzureMySQLConfig(host="h", user="u", database="d", password="p")
Defensive patterns
Strategy: validation
Validate before calling
from mem0.configs.vector_stores.azure_mysql import AzureMySQLConfig
def prune_extra(cfg: dict) -> dict:
allowed = set(AzureMySQLConfig.model_fields)
extra = set(cfg) - allowed
if extra:
raise RuntimeError(f"Unexpected azure_mysql keys: {sorted(extra)}; allowed: {sorted(allowed)}")
return cfg Type guard
def azure_mysql_keys_valid(cfg: dict) -> bool:
return not (set(cfg) - set(AzureMySQLConfig.model_fields)) Try / catch
from pydantic import ValidationError
try:
AzureMySQLConfig(**cfg)
except ValidationError as e:
if "Extra fields not allowed" in str(e):
# strip or fix the listed keys, then retry
... Prevention
- Diff config keys against model_fields before construction
- Avoid sharing one config dict across vector store providers
- Smoke-test saved configs after every mem0 upgrade
When it happens
Trigger: Passing any key not in the model's declared fields to AzureMySQLConfig — e.g. 'port' if not a declared field, 'password_file', 'pool_size', or leftover keys from another provider's config merged into this one.
Common situations: Copy-pasting an AWS RDS or plain MySQL config into the azure_mysql section; renaming fields between mem0 versions while keeping old keys; passing connection string parameters individually when the model only accepts a subset.
Related errors
- Either 'password' must be provided or 'use_azure_credential'
- Missing required fields: {', '.join(missing_fields)}. These
- 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/24af1895e7b78038.
Report an issue: GitHub.