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

SupabaseConfig runs a strict extra-fields validator that rejects any config key outside its declared set (connection_string, collection_name, embedding_model_dims, index_method, index_measure). Together with check_connection_string it forms a two-stage `before` validation: unknown keys and bad connection strings both fail fast, before any DB connection is attempted.

Source

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

    embedding_model_dims: Optional[int] = Field(1536, description="Dimensions of the embedding model")
    index_method: Optional[IndexMethod] = Field(IndexMethod.AUTO, description="Index method to use")
    index_measure: Optional[IndexMeasure] = Field(IndexMeasure.COSINE, description="Distance measure to use")

    @model_validator(mode="before")
    def check_connection_string(cls, values):
        conn_str = values.get("connection_string")
        if not conn_str or not conn_str.startswith("postgresql://"):
            raise ValueError("A valid PostgreSQL connection string must be provided")
        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=False)

View on GitHub (pinned to 001c235229)

Solutions

  1. Reduce the config to the allowed fields: connection_string, collection_name, embedding_model_dims, index_method, index_measure
  2. Assemble host/port/user/password into one postgresql:// connection string instead of separate keys
  3. Check for typos against the allowed list printed in the error message

Example fix

# before
config = {"connection_string": "postgresql://...", "host": "db.xyz.supabase.co", "user": "postgres"}

# after
config = {"connection_string": "postgresql://postgres:pass@db.xyz.supabase.co:5432/postgres", "collection_name": "mem0"}
Defensive patterns

Strategy: validation

Validate before calling

from mem0.configs.vector_stores.supabase import SupabaseConfig
extra = set(cfg) - set(SupabaseConfig.model_fields)
if extra:
    raise ConfigError(f"remove extra supabase config keys: {sorted(extra)}")

Prevention

When it happens

Trigger: Passing keys like host, port, user, password, or table_name in the supabase vector store config; passing an 'api_key' or Supabase URL; any key copied from another provider's config template.

Common situations: Splitting a postgresql:// URL into host/port/user/password components (this config wants the single connection_string); assuming a Supabase service-role key is needed here; using a pgvector-style config from the mem0 'postgres' provider example.

Related errors


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