mem0ai/mem0 · error · ValueError
Invalid compression_type: {values['compression_type']}. Must
Error message
Invalid compression_type: {values['compression_type']}. Must be one of: {', '.join(valid_types)}, or None What it means
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.
Source
Thrown at mem0/configs/vector_stores/azure_ai_search.py:50
# Check for use_compression to provide a helpful error
if "use_compression" in extra_fields:
raise ValueError(
"The parameter 'use_compression' is no longer supported. "
"Please use 'compression_type=\"scalar\"' instead of 'use_compression=True' "
"or 'compression_type=None' instead of 'use_compression=False'."
)
if extra_fields:
raise ValueError(
f"Extra fields not allowed: {', '.join(extra_fields)}. "
f"Please input only the following fields: {', '.join(allowed_fields)}"
)
# Validate compression_type values
if "compression_type" in values and values["compression_type"] is not None:
valid_types = ["scalar", "binary"]
if values["compression_type"].lower() not in valid_types:
raise ValueError(
f"Invalid compression_type: {values['compression_type']}. "
f"Must be one of: {', '.join(valid_types)}, or None"
)
return values
model_config = ConfigDict(arbitrary_types_allowed=True)
View on GitHub (pinned to 001c235229)
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
Example fix
# before
"config": {"service_name": S, "api_key": K, "compression_type": "none"}
# after
"config": {"service_name": S, "api_key": K, "compression_type": None} Defensive patterns
Strategy: validation
Validate before calling
VALID = {"scalar", "binary"}
if "compression_type" in cfg and cfg["compression_type"] is not None:
if str(cfg["compression_type"]).strip().lower() not in VALID:
raise ConfigError(f"compression_type must be one of {sorted(VALID)} or None") Type guard
from typing import Optional
def is_valid_compression(v) -> bool:
return v is None or str(v).strip().lower() in {"scalar", "binary"} Try / catch
try:
Memory.from_config(config)
except ValueError as e:
if "Invalid compression_type" in str(e):
config["vector_store"]["config"]["compression_type"] = None
Memory.from_config(config)
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Extra fields not allowed: {', '.join(extra_fields)}. Please
- Baidu vector store requires a non-empty '${name}' config val
- The parameter 'use_compression' is no longer supported. Plea
- Invalid collection_name: {v!r}. Must start with a letter or
- Unsupported VectorStore provider: {provider_name}
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/0bca913d21f9e3a9.
Report an issue: GitHub.