{"record":{"id":"199af48ad1706014","repo":"mem0ai/mem0","slug":"extra-fields-not-allowed-join-extra-fields-199af4","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/faiss.py","lineNumber":32,"sourceCode":"    )\n    embedding_model_dims: int = Field(1536, description=\"Dimension of the embedding vector\")\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def validate_distance_strategy(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        distance_strategy = values.get(\"distance_strategy\")\n        if distance_strategy and distance_strategy not in [\"euclidean\", \"inner_product\", \"cosine\"]:\n            raise ValueError(\"Invalid distance_strategy. Must be one of: 'euclidean', 'inner_product', 'cosine'\")\n        return values\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        if extra_fields:\n            raise ValueError(\n                f\"Extra fields not allowed: {', '.join(extra_fields)}. Please input only the following fields: {', '.join(allowed_fields)}\"\n            )\n        return values\n\n    model_config = ConfigDict(arbitrary_types_allowed=True)\n","sourceCodeStart":14,"sourceCodeEnd":38,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/faiss.py#L14-L38","documentation":"Raised by the Faiss config's strict extra-fields validator. Keys not declared on FaissConfig are rejected with an error that lists both the offending keys and the complete allowed field set. It prevents silently-ignored typos in a config surface that is otherwise small.","triggerScenarios":"Passing FaissConfig keys like 'nlist', 'nprobe', 'index_type', or any FAISS tuning parameter that is not a declared field of the model.","commonSituations":"Transcribing FAISS IndexIVFFlat constructor params into the config; carrying fields over from another vector store's config block; stale keys after a mem0 upgrade changed the field set.","solutions":["Remove the extra key(s) named in the error message","Check remaining keys against the allowed list embedded in the error text","Tune FAISS beyond exposed fields by building/managing the index outside the config","Re-validate configs against your installed mem0 version after any upgrade"],"exampleFix":"# before\nFaissConfig(distance_strategy=\"cosine\", nlist=100)\n\n# after\nFaissConfig(distance_strategy=\"cosine\")","handlingStrategy":"validation","validationCode":"from mem0.configs.vector_stores.faiss import FaissConfig\ndef prune_faiss_extra(cfg: dict) -> dict:\n    extra = set(cfg) - set(FaissConfig.model_fields)\n    if extra:\n        raise RuntimeError(f\"Unexpected faiss keys: {sorted(extra)}\")\n    return cfg","typeGuard":"def faiss_keys_valid(cfg: dict) -> bool:\n    return not (set(cfg) - set(FaissConfig.model_fields))","tryCatchPattern":"from pydantic import ValidationError\ntry:\n    FaissConfig(**cfg)\nexcept ValidationError as e:\n    if \"Extra fields not allowed\" in str(e):\n        # drop FAISS tuning params not exposed by the model\n        ...","preventionTips":["Do not put FAISS index params (nlist, nprobe) in the config","Validate keys against model_fields pre-construction","Re-check field sets after each mem0 upgrade"],"tags":["pydantic","configuration","vector-store","faiss","strict-schema"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}