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
The Azure AI Search config model forbids unknown keys: any field in the input that is not a declared model field raises ValueError listing the offending names and the allowed set. This catches typos and stale options at config-parse time, before any Azure SDK call. use_compression gets its own more specific message first.
Source
Thrown at mem0/configs/vector_stores/azure_ai_search.py:41
)
@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
# Check for use_compression to provide a helpful error
if "use_compression" in extra_fields:
raise ValueError(
"The parameter 'use_compression' is no longer supported. "
"Please use 'compression_type=\"scalar\"' instead of 'use_compression=True' "
"or 'compression_type=None' instead of 'use_compression=False'."
)
if extra_fields:
raise ValueError(
f"Extra fields not allowed: {', '.join(extra_fields)}. "
f"Please input only the following fields: {', '.join(allowed_fields)}"
)
# Validate compression_type values
if "compression_type" in values and values["compression_type"] is not None:
valid_types = ["scalar", "binary"]
if values["compression_type"].lower() not in valid_types:
raise ValueError(
f"Invalid compression_type: {values['compression_type']}. "
f"Must be one of: {', '.join(valid_types)}, or None"
)
return values
model_config = ConfigDict(arbitrary_types_allowed=True)
View on GitHub (pinned to 001c235229)
Solutions
- Read the error message — it enumerates both the bad fields and the exact allowed field list; fix accordingly
- Compare your config against mem0/configs/vector_stores/azure_ai_search.py model fields for your installed version
- Remove keys inherited from examples for other providers (qdrant, chroma, etc.)
Example fix
# before
"config": {"service_name": S, "api_key": K, "embedding_dim": 1536}
# after
"config": {"service_name": S, "api_key": K, "embedding_dimensions": 1536} Defensive patterns
Strategy: validation
Validate before calling
from mem0.configs.vector_stores.azure_ai_search import AzureAISearchConfig
allowed = set(AzureAISearchConfig.model_fields)
unknown = set(my_config) - allowed
if unknown:
raise ConfigError(f"unknown azure_ai_search fields: {sorted(unknown)}; allowed: {sorted(allowed)}") Type guard
def azure_cfg_keys_valid(cfg: dict) -> bool:
from mem0.configs.vector_stores.azure_ai_search import AzureAISearchConfig
return not (set(cfg) - set(AzureAISearchConfig.model_fields)) Try / catch
try:
Memory.from_config(config)
except ValueError as e:
if "Extra fields not allowed" in str(e):
raise ConfigError(f"fix vector store config: {e}") from e
raise Prevention
- Validate provider config dicts against the installed version's model_fields before constructing Memory
- Keep one canonical config per provider instead of copying between providers
When it happens
Trigger: Passing misspelled or outdated keys in vector_store.config for provider azure_ai_search, e.g. 'service_name' vs current name, 'index_name' vs 'collection_name', or keys belonging to other providers like 'dim' or 'embedding_dimension'.
Common situations: Copying config snippets between vector store providers; upgrading mem0ai when field names changed; hand-written YAML with typos; LLM-generated configs with hallucinated field names.
Related errors
- Invalid compression_type: {values['compression_type']}. Must
- Baidu vector store requires a non-empty '${name}' config val
- The parameter 'use_compression' is no longer supported. Plea
- Invalid collection_name: {v!r}. Must start with a letter or
- Unsupported VectorStore provider: {provider_name}
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/7a15b90ede62faed.
Report an issue: GitHub.