{"record":{"id":"24af1895e7b78038","repo":"mem0ai/mem0","slug":"extra-fields-not-allowed-join-extra-fields-24af18","errorCode":null,"errorMessage":"Extra fields not allowed: {', '.join(extra_fields)}. Please input only the following fields: {', '.join(allowed_fields)}","messagePattern":"Extra fields not allowed: (.+?)\\. Please input only the following fields: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/configs/vector_stores/azure_mysql.py","lineNumber":90,"sourceCode":"\n        if missing_fields:\n            raise ValueError(\n                f\"Missing required fields: {', '.join(missing_fields)}. \"\n                f\"These fields are required when not using a pre-configured connection_pool.\"\n            )\n\n        return values\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        \"\"\"Validate that no extra fields are provided.\"\"\"\n        allowed_fields = set(cls.model_fields.keys())\n        input_fields = set(values.keys())\n        extra_fields = input_fields - allowed_fields\n\n        if extra_fields:\n            raise ValueError(\n                f\"Extra fields not allowed: {', '.join(extra_fields)}. \"\n                f\"Please input only the following fields: {', '.join(allowed_fields)}\"\n            )\n\n        return values\n\n    model_config = ConfigDict(arbitrary_types_allowed=True)\n","sourceCodeStart":72,"sourceCodeEnd":98,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/azure_mysql.py#L72-L98","documentation":"Raised by the AzureMySQL config's strict extra-fields validator. The model computes set(keys) - set(model_fields) and rejects any key that is not a declared field, so the config acts as a closed schema. This catches typos and stale option names early instead of silently ignoring them.","triggerScenarios":"Passing any key not in the model's declared fields to AzureMySQLConfig — e.g. 'port' if not a declared field, 'password_file', 'pool_size', or leftover keys from another provider's config merged into this one.","commonSituations":"Copy-pasting an AWS RDS or plain MySQL config into the azure_mysql section; renaming fields between mem0 versions while keeping old keys; passing connection string parameters individually when the model only accepts a subset.","solutions":["Remove or rename the extra field(s) listed in the error message so only declared fields remain","Diff your config keys against the allowed list printed in the error message itself","If the field is genuinely needed (e.g. port), wrap the connection in your own connection_pool instead of extending the model","Pin the mem0 version and re-read that version's AzureMySQLConfig field list after upgrades"],"exampleFix":"# before\nAzureMySQLConfig(host=\"h\", user=\"u\", database=\"d\", password=\"p\", ssl_verify_cert=True)\n\n# after\nAzureMySQLConfig(host=\"h\", user=\"u\", database=\"d\", password=\"p\")","handlingStrategy":"validation","validationCode":"from mem0.configs.vector_stores.azure_mysql import AzureMySQLConfig\ndef prune_extra(cfg: dict) -> dict:\n    allowed = set(AzureMySQLConfig.model_fields)\n    extra = set(cfg) - allowed\n    if extra:\n        raise RuntimeError(f\"Unexpected azure_mysql keys: {sorted(extra)}; allowed: {sorted(allowed)}\")\n    return cfg","typeGuard":"def azure_mysql_keys_valid(cfg: dict) -> bool:\n    return not (set(cfg) - set(AzureMySQLConfig.model_fields))","tryCatchPattern":"from pydantic import ValidationError\ntry:\n    AzureMySQLConfig(**cfg)\nexcept ValidationError as e:\n    if \"Extra fields not allowed\" in str(e):\n        # strip or fix the listed keys, then retry\n        ...","preventionTips":["Diff config keys against model_fields before construction","Avoid sharing one config dict across vector store providers","Smoke-test saved configs after every mem0 upgrade"],"tags":["pydantic","configuration","vector-store","azure","mysql","strict-schema"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}