{"record":{"id":"7a15b90ede62faed","repo":"mem0ai/mem0","slug":"extra-fields-not-allowed-join-extra-fields","errorCode":null,"errorMessage":"Extra fields not allowed: {', '.join(extra_fields)}. Please input only the following fields: {', '.join(allowed_fields)}","messagePattern":"Extra fields not allowed: (.+?)\\. Please input only the following fields: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/configs/vector_stores/azure_ai_search.py","lineNumber":41,"sourceCode":"    )\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        allowed_fields = set(cls.model_fields.keys())\n        input_fields = set(values.keys())\n        extra_fields = input_fields - allowed_fields\n\n        # Check for use_compression to provide a helpful error\n        if \"use_compression\" in extra_fields:\n            raise ValueError(\n                \"The parameter 'use_compression' is no longer supported. \"\n                \"Please use 'compression_type=\\\"scalar\\\"' instead of 'use_compression=True' \"\n                \"or 'compression_type=None' instead of 'use_compression=False'.\"\n            )\n\n        if extra_fields:\n            raise ValueError(\n                f\"Extra fields not allowed: {', '.join(extra_fields)}. \"\n                f\"Please input only the following fields: {', '.join(allowed_fields)}\"\n            )\n\n        # Validate compression_type values\n        if \"compression_type\" in values and values[\"compression_type\"] is not None:\n            valid_types = [\"scalar\", \"binary\"]\n            if values[\"compression_type\"].lower() not in valid_types:\n                raise ValueError(\n                    f\"Invalid compression_type: {values['compression_type']}. \"\n                    f\"Must be one of: {', '.join(valid_types)}, or None\"\n                )\n\n        return values\n\n    model_config = ConfigDict(arbitrary_types_allowed=True)\n","sourceCodeStart":23,"sourceCodeEnd":58,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/azure_ai_search.py#L23-L58","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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.)"],"exampleFix":"# before\n\"config\": {\"service_name\": S, \"api_key\": K, \"embedding_dim\": 1536}\n\n# after\n\"config\": {\"service_name\": S, \"api_key\": K, \"embedding_dimensions\": 1536}","handlingStrategy":"validation","validationCode":"from mem0.configs.vector_stores.azure_ai_search import AzureAISearchConfig\n\nallowed = set(AzureAISearchConfig.model_fields)\nunknown = set(my_config) - allowed\nif unknown:\n    raise ConfigError(f\"unknown azure_ai_search fields: {sorted(unknown)}; allowed: {sorted(allowed)}\")","typeGuard":"def azure_cfg_keys_valid(cfg: dict) -> bool:\n    from mem0.configs.vector_stores.azure_ai_search import AzureAISearchConfig\n    return not (set(cfg) - set(AzureAISearchConfig.model_fields))","tryCatchPattern":"try:\n    Memory.from_config(config)\nexcept ValueError as e:\n    if \"Extra fields not allowed\" in str(e):\n        raise ConfigError(f\"fix vector store config: {e}\") from e\n    raise","preventionTips":["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"],"tags":["configuration","azure-ai-search","vector-store","validation"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}