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
S3VectorsConfig's `before` model_validator rejects any configuration key that is not a declared field (the S3 Vectors options: bucket name/arn, vector store name/arn, region_name, distance metric, embedding_model_dims, etc.). The message enumerates both the rejected keys and the full allowed set, so the fix is mechanical.
Source
Thrown at mem0/configs/vector_stores/s3_vectors.py:23
class S3VectorsConfig(BaseModel):
vector_bucket_name: str = Field(description="Name of the S3 Vector bucket")
collection_name: str = Field("mem0", description="Name of the vector index")
embedding_model_dims: int = Field(1536, description="Dimension of the embedding vector")
distance_metric: str = Field(
"cosine",
description="Distance metric for similarity search. Options: 'cosine', 'euclidean'",
)
region_name: Optional[str] = Field(None, description="AWS region for the S3 Vectors client")
@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
- Delete the extra keys named in the error so the dict only uses fields from the allowed list in the message
- Supply AWS credentials via environment variables (AWS_ACCESS_KEY_ID etc.), an IAM role, or ~/.aws/credentials instead of the config dict
- Check the S3VectorsConfig field declarations for the exact accepted names (e.g. region_name for the AWS region)
Example fix
# before
config = {"bucket_name": "my-bucket", "aws_access_key_id": "...", "aws_secret_access_key": "..."}
# after
config = {"bucket_name": "my-bucket", "region_name": "us-east-1"} # credentials from env/IAM Defensive patterns
Strategy: validation
Validate before calling
from mem0.configs.vector_stores.s3_vectors import S3VectorsConfig
extra = set(cfg) - set(S3VectorsConfig.model_fields)
assert not extra, f"extra keys: {extra}" Prevention
- Never put AWS credentials in the vector store config; use env vars or IAM roles
- Validate config dicts against the Pydantic model before passing them to Memory
When it happens
Trigger: Calling Memory with vector_store={'provider': 's3_vectors', 'config': {...}} where the config dict contains keys not declared on S3VectorsConfig — typical offenders are AWS credential keys (aws_access_key_id, aws_secret_access_key), profile, or keys copied from other vector store configs.
Common situations: Assuming AWS credentials belong in the vector store config (they belong in the environment, IAM roles, or the boto3 client passed separately); copying an example config for another provider; using a field name from an older mem0 release.
Related errors
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- A valid PostgreSQL connection string must be provided
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Extra fields not allowed: {', '.join(extra_fields)}. Please
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/cfefacaf61756734.
Report an issue: GitHub.