{"record":{"id":"f5a9d26e72478ed9","repo":"mem0ai/mem0","slug":"extra-fields-not-allowed-join-extra-fields-f5a9d2","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/valkey.py","lineNumber":26,"sourceCode":"\n    valkey_url: str = Field(..., description=\"Valkey server URL (e.g., redis://localhost:6379)\")\n    collection_name: str = Field(..., description=\"Name of the index / collection\")\n    embedding_model_dims: int = Field(..., description=\"Dimensions of the embedding model\")\n    timezone: str = Field(\"UTC\", description=\"Timezone for timestamp handling\")\n    index_type: str = Field(\"hnsw\", description=\"Index type: 'hnsw' (default) or 'flat'\")\n    hnsw_m: int = Field(16, description=\"HNSW: number of connections per layer\")\n    hnsw_ef_construction: int = Field(200, description=\"HNSW: search width during index construction\")\n    hnsw_ef_runtime: int = Field(10, description=\"HNSW: search width during queries\")\n    cluster_mode: bool = Field(False, description=\"Enable cluster mode for Valkey cluster (CME) deployments\")\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)}. \"\n                f\"Please input only the following fields: {', '.join(allowed_fields)}\"\n            )\n        return values\n\n    model_config = ConfigDict(arbitrary_types_allowed=False)\n","sourceCodeStart":8,"sourceCodeEnd":33,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/valkey.py#L8-L33","documentation":"The Valkey config model closes its field set: only the declared Valkey options (connection settings plus HNSW knobs hnsw_m, hnsw_ef_construction, hnsw_ef_runtime, cluster_mode, collection_name, embedding_model_dims, and neighbors) are accepted. A `before` model_validator computes set(keys) - set(model_fields) and raises this error listing the extras and the allowed names.","triggerScenarios":"Passing Redis-style keys (redis_url) or auth fields in a valkey config; misspelling hnsw fields (e.g. 'ef_construction' without the hnsw_ prefix); including keys from the Redis config template since Valkey is Redis-compatible.","commonSituations":"Treating the valkey provider config as identical to the redis provider config; copying HNSW tuning from Valkey docs that use bare parameter names; version drift after a field rename.","solutions":["Strip the config down to the allowed fields named in the error message","Use the valkey-specific key names (valkey_url / host+port as declared) rather than the redis_* spellings","Prefix HNSW options exactly as declared: hnsw_m, hnsw_ef_construction, hnsw_ef_runtime"],"exampleFix":"# before\nconfig = {\"redis_url\": \"redis://localhost:6379\", \"ef_construction\": 200}\n\n# after\nconfig = {\"host\": \"localhost\", \"port\": 6379, \"hnsw_ef_construction\": 200}","handlingStrategy":"validation","validationCode":"from mem0.configs.vector_stores.valkey import ValkeyDBConfig  # name per repo\nextra = set(cfg) - set(ValkeyDBConfig.model_fields)\nif extra:\n    raise ConfigError(f\"unknown valkey config keys: {sorted(extra)}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't reuse redis config dicts for valkey — field names differ","Keep HNSW keys prefixed exactly hnsw_m / hnsw_ef_construction / hnsw_ef_runtime"],"tags":["pydantic","valkey","vector-store","config","validation"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}