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

Raised by ChromaDbConfig's strict extra-fields validator: any constructor key outside the declared model fields is rejected with a message listing the extras and the allowed set. It runs after the cloud/local checks, so a valid connection config can still fail on a typo'd key.

Source

Thrown at mem0/configs/vector_stores/chroma.py:53

        # Check if local/server configuration is provided
        local_config = bool(path) or bool(host and port)
        
        if not cloud_config and not local_config:
            raise ValueError("Either ChromaDB Cloud configuration (api_key, tenant) or local configuration (path or host/port) must be provided.")
        
        if cloud_config and local_config:
            raise ValueError("Cannot specify both cloud configuration and local configuration. Choose one.")
            
        return values

    @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 key(s) named in the error
  2. Verify the surviving keys against the allowed list in the error message
  3. Configure advanced chromadb options by passing your own 'client' instance instead of extra config keys
  4. Re-check the field list for your installed mem0 version after upgrades

Example fix

# before
ChromaDbConfig(path="./db", anonymized_telemetry=False)

# after
import chromadb
client = chromadb.PersistentClient(path="./db", anonymized_telemetry=False)
ChromaDbConfig(client=client)
Defensive patterns

Strategy: validation

Validate before calling

from mem0.configs.vector_stores.chroma import ChromaDbConfig
def prune_chroma_extra(cfg: dict) -> dict:
    extra = set(cfg) - set(ChromaDbConfig.model_fields)
    if extra:
        raise RuntimeError(f"Unexpected chroma keys: {sorted(extra)}")
    return cfg

Type guard

def chroma_keys_valid(cfg: dict) -> bool:
    return not (set(cfg) - set(ChromaDbConfig.model_fields))

Try / catch

from pydantic import ValidationError
try:
    ChromaDbConfig(**cfg)
except ValidationError as e:
    if "Extra fields not allowed" in str(e):
        # move unsupported options into a custom client instance
        ...

Prevention

When it happens

Trigger: Passing ChromaDbConfig keys like 'collection_metadata', 'anonymized_telemetry', 'settings', or any chromadb.PersistentClient kwarg that is not a declared field.

Common situations: Copying chromadb client settings into the mem0 config; leftover keys after renaming in a mem0 release; configs shared across providers accumulating stray keys.

Related errors


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