{"record":{"id":"0bca913d21f9e3a9","repo":"mem0ai/mem0","slug":"invalid-compression-type-values-compression-typ","errorCode":null,"errorMessage":"Invalid compression_type: {values['compression_type']}. Must be one of: {', '.join(valid_types)}, or None","messagePattern":"Invalid compression_type: (.+?)\\. Must be one of: (.+?), or None","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mem0/configs/vector_stores/azure_ai_search.py","lineNumber":50,"sourceCode":"        # Check for use_compression to provide a helpful error\n        if \"use_compression\" in extra_fields:\n            raise ValueError(\n                \"The parameter 'use_compression' is no longer supported. \"\n                \"Please use 'compression_type=\\\"scalar\\\"' instead of 'use_compression=True' \"\n                \"or 'compression_type=None' instead of 'use_compression=False'.\"\n            )\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        # Validate compression_type values\n        if \"compression_type\" in values and values[\"compression_type\"] is not None:\n            valid_types = [\"scalar\", \"binary\"]\n            if values[\"compression_type\"].lower() not in valid_types:\n                raise ValueError(\n                    f\"Invalid compression_type: {values['compression_type']}. \"\n                    f\"Must be one of: {', '.join(valid_types)}, or None\"\n                )\n\n        return values\n\n    model_config = ConfigDict(arbitrary_types_allowed=True)\n","sourceCodeStart":32,"sourceCodeEnd":58,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0/configs/vector_stores/azure_ai_search.py#L32-L58","documentation":"Within the Azure AI Search config's pre-validator, compression_type (when not None) must be exactly 'scalar' or 'binary', compared case-insensitively via .lower(). Any other string raises ValueError naming the invalid value and the allowed options. This runs before extra-field checks return, at config construction time.","triggerScenarios":"Setting compression_type to e.g. 'none', 'int8', 'pq', 'product', or 'SCALAR ' (trailing space) in the azure_ai_search config; note None disables compression and is valid.","commonSituations":"Mapping Azure terminology (e.g. 'rescoringOptions', 'half', 'int8') into compression_type; users assuming an 'off' string instead of None; values sourced from YAML where quotes make \"null\" a string.","solutions":["Use compression_type=\"scalar\" or \"binary\" (any casing), or None to disable compression","In YAML, write compression_type: (empty) or null, never the string \"none\"","Strip whitespace from values injected from external config sources"],"exampleFix":"# before\n\"config\": {\"service_name\": S, \"api_key\": K, \"compression_type\": \"none\"}\n\n# after\n\"config\": {\"service_name\": S, \"api_key\": K, \"compression_type\": None}","handlingStrategy":"validation","validationCode":"VALID = {\"scalar\", \"binary\"}\nif \"compression_type\" in cfg and cfg[\"compression_type\"] is not None:\n    if str(cfg[\"compression_type\"]).strip().lower() not in VALID:\n        raise ConfigError(f\"compression_type must be one of {sorted(VALID)} or None\")","typeGuard":"from typing import Optional\n\ndef is_valid_compression(v) -> bool:\n    return v is None or str(v).strip().lower() in {\"scalar\", \"binary\"}","tryCatchPattern":"try:\n    Memory.from_config(config)\nexcept ValueError as e:\n    if \"Invalid compression_type\" in str(e):\n        config[\"vector_store\"][\"config\"][\"compression_type\"] = None\n        Memory.from_config(config)\n    else:\n        raise","preventionTips":["Use an enum/Literal for compression_type in your own config schema; use None for 'off'","Beware YAML quoting: 'null' or 'none' strings are not None"],"tags":["configuration","azure-ai-search","vector-store","validation","compression"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}