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 the Databricks vector store config's strict extra-fields validator. Every key passed to DatabricksConfig must match a declared model field; the difference set is rejected before authentication validation even runs. It is a closed-schema typo guard.

Source

Thrown at mem0/configs/vector_stores/databricks.py:41

    collection_name: str = Field("mem0", description="Vector search index name")
    index_type: VectorIndexType = Field("DELTA_SYNC", description="Index type: DELTA_SYNC or DIRECT_ACCESS")
    embedding_model_endpoint_name: Optional[str] = Field(
        None, description="Embedding model endpoint for Databricks-computed embeddings"
    )
    embedding_dimension: int = Field(1536, description="Vector embedding dimensions")
    endpoint_type: EndpointType = Field("STANDARD", description="Endpoint type: STANDARD or STORAGE_OPTIMIZED")
    pipeline_type: PipelineType = Field("TRIGGERED", description="Sync pipeline type: TRIGGERED or CONTINUOUS")
    warehouse_name: Optional[str] = Field(None, description="Databricks SQL warehouse Name")
    query_type: str = Field("ANN", description="Query type: `ANN` and `HYBRID`")

    @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_validator(mode="after")
    def validate_authentication(self):
        """Validate that either access_token or service principal credentials are provided."""
        has_token = self.access_token is not None
        has_service_principal = (self.client_id is not None and self.client_secret is not None) or (
            self.azure_client_id is not None and self.azure_client_secret is not None
        )

        if not has_token and not has_service_principal:
            raise ValueError(
                "Either access_token or both client_id/client_secret or azure_client_id/azure_client_secret must be provided"
            )

        return self

View on GitHub (pinned to 001c235229)

Solutions

  1. Remove or correct the extra key(s) listed in the error message
  2. Use the exact declared names — check the allowed-fields list printed in the error
  3. Confirm you are on a mem0 version whose DatabricksConfig supports the fields you need
  4. Store Databricks options you cannot express as fields at the client level, not in the config dict

Example fix

# before
DatabricksConfig(host="https://adb-...", access_token="t", warehouse_id="abc")

# after
DatabricksConfig(host="https://adb-...", access_token="t", warehouse_name="my-warehouse")
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

def databricks_keys_valid(cfg: dict) -> bool:
    return not (set(cfg) - set(DatabricksConfig.model_fields))

Try / catch

from pydantic import ValidationError
try:
    DatabricksConfig(**cfg)
except ValidationError as e:
    if "Extra fields not allowed" in str(e):
        # rename to the declared field names listed in the message
        ...

Prevention

When it happens

Trigger: Constructing DatabricksConfig with keys outside its field set — e.g. 'warehouse_id' vs the supported 'warehouse_name', 'catalog', or options copied from another provider's config.

Common situations: Databricks terminology drift (workspace URL keys, warehouse identifiers) mapped to guessed field names; configs inherited from a qdrant/milvus setup; field renames between mem0 versions.

Related errors


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