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

RedisDBConfig is a Pydantic model whose `before` model_validator rejects any input key that is not one of the declared fields (redis_url, collection_name, embedding_model_dims). The error message lists the offending keys and the allowed set. It exists to catch typos and stale option names before the Redis client is constructed.

Source

Thrown at mem0/configs/vector_stores/redis.py:19

from typing import Any, Dict

from pydantic import BaseModel, ConfigDict, Field, model_validator


# TODO: Upgrade to latest pydantic version
class RedisDBConfig(BaseModel):
    redis_url: str = Field(..., description="Redis URL")
    collection_name: str = Field("mem0", description="Collection name")
    embedding_model_dims: int = Field(1536, description="Embedding model dimensions")

    @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
        if extra_fields:
            raise ValueError(
                f"Extra fields not allowed: {', '.join(extra_fields)}. 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

  1. Remove the extra keys listed in the error message so the config dict contains only redis_url, collection_name, embedding_model_dims
  2. Move credentials into the URL: redis_url='redis://:password@host:6379/0' instead of separate password/host fields
  3. Rename a mistyped key to the exact allowed name shown in the 'Please input only the following fields' list

Example fix

# before
config = {"redis_url": "redis://localhost:6379", "host": "localhost", "password": "secret"}

# after
config = {"redis_url": "redis://:secret@localhost:6379/0", "collection_name": "mem0", "embedding_model_dims": 1536}
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED = {"redis_url", "collection_name", "embedding_model_dims"}
extra = set(cfg) - ALLOWED
if extra:
    raise ConfigError(f"Unsupported redis config keys: {extra}")

Prevention

When it happens

Trigger: Instantiating Memory with vector_store={'provider': 'redis', 'config': {...}} where the config dict contains any key outside redis_url/collection_name/embedding_model_dims — e.g. a copied-over 'host'/'port', 'password', 'db', or 'user' key from another store's config.

Common situations: Copying a config block from a Qdrant/Chroma/FAISS example and leaving foreign keys in it; upgrading mem0 versions where a Redis option was renamed or removed; passing auth fields directly instead of embedding them in redis_url.

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/425ae6b13c5ff31a. Report an issue: GitHub.