{"record":{"id":"f333d93eeb8a57e7","repo":"mem0ai/mem0","slug":"missing-required-fields-join-missing-fields","errorCode":null,"errorMessage":"Missing required fields: {', '.join(missing_fields)}. These fields are required when not using a pre-configured connection_pool.","messagePattern":"Missing required fields: (.+?)\\. These fields are required when not using a pre-configured connection_pool\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/configs/vector_stores/azure_mysql.py","lineNumber":74,"sourceCode":"            raise ValueError(\n                \"Either 'password' must be provided or 'use_azure_credential' must be set to True\"\n            )\n\n        return values\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def check_required_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:\n        \"\"\"Validate required fields.\"\"\"\n        # If connection_pool is provided, skip validation of individual parameters\n        if values.get(\"connection_pool\") is not None:\n            return values\n\n        required_fields = [\"host\", \"user\", \"database\"]\n        missing_fields = [field for field in required_fields if not values.get(field)]\n\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)}\"","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/azure_mysql.py#L56-L92","documentation":"Raised by the AzureMySQL config validator when required connection fields are missing. Host, user, and database are mandatory unless you supply a pre-configured connection_pool that already encapsulates connectivity. It fires during Pydantic model validation, before any network call is attempted.","triggerScenarios":"Constructing AzureMySQLConfig without 'connection_pool' and with any of 'host', 'user', or 'database' absent, None, or empty string. Commonly hit when the config dict is nested one level too shallow or keys are misspelled.","commonSituations":"YAML/JSON config where the connection block was accidentally flattened into the parent; typos ('hostname' instead of 'host'); partial configs left over from switching providers; CI using a different template than local dev.","solutions":["Add the missing field(s) named in the error message to the config dict (exact names: host, user, database)","If you already manage connections yourself, pass 'connection_pool' to skip field validation entirely","Check spelling and nesting of keys against the error's missing-field list","Add a startup assertion or schema check for the config file so this fails loudly in CI, not at runtime"],"exampleFix":"# before\nAzureMySQLConfig(user=\"admin\", database=\"mem0\")\n\n# after\nAzureMySQLConfig(host=\"myserver.mysql.database.azure.com\", user=\"admin\", database=\"mem0\", password=os.environ[\"MYSQL_PWD\"])","handlingStrategy":"validation","validationCode":"REQUIRED = (\"host\", \"user\", \"database\")\ndef validate_azure_mysql_fields(cfg: dict) -> None:\n    if cfg.get(\"connection_pool\") is not None:\n        return\n    missing = [k for k in REQUIRED if not cfg.get(k)]\n    if missing:\n        raise RuntimeError(f\"azure_mysql config missing: {', '.join(missing)}\")","typeGuard":"def is_complete_azure_mysql_cfg(cfg: dict) -> bool:\n    return cfg.get(\"connection_pool\") is not None or all(cfg.get(k) for k in (\"host\", \"user\", \"database\"))","tryCatchPattern":"from pydantic import ValidationError\ntry:\n    AzureMySQLConfig(**cfg)\nexcept ValidationError as e:\n    if \"Missing required fields\" in str(e):\n        # surface to config author / fail deployment\n        ...","preventionTips":["Validate config dicts against a required-key list in CI","Load configs from typed sources (pydantic settings) so missing keys fail at load time with clear errors","Keep provider config nesting uniform across environments"],"tags":["pydantic","configuration","vector-store","azure","mysql","required-fields"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}