mem0ai/mem0 · error · ValueError

The parameter 'use_compression' is no longer supported. Plea

Error message

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'.

What it means

The Azure AI Search vector store config rejects the legacy use_compression boolean, which was replaced by a compression_type field ('scalar', 'binary', or None). A dedicated branch in the model_validator(mode='before') detects use_compression among the extra fields and raises a ValueError with explicit migration instructions.

Source

Thrown at mem0/configs/vector_stores/azure_ai_search.py:34

        description="Whether to store vectors in half precision (Edm.Half) instead of full precision (Edm.Single)",
    )
    hybrid_search: bool = Field(
        False, description="Whether to use hybrid search. If True, vector_filter_mode must be 'preFilter'"
    )
    vector_filter_mode: Optional[str] = Field(
        "preFilter", description="Mode for vector filtering. Options: 'preFilter', 'postFilter'"
    )

    @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

        # 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"

View on GitHub (pinned to 001c235229)

Solutions

  1. Replace use_compression=True with compression_type="scalar"
  2. Replace use_compression=False with compression_type=None (or omit the key)
  3. Grep your config files and env templates for 'use_compression' after upgrading mem0ai

Example fix

# before
vector_store={
    "provider": "azure_ai_search",
    "config": {"service_name": S, "api_key": K, "use_compression": True},
}

# after
vector_store={
    "provider": "azure_ai_search",
    "config": {"service_name": S, "api_key": K, "compression_type": "scalar"},
}
Defensive patterns

Strategy: validation

Validate before calling

cfg = {"service_name": S, "api_key": K}
if legacy_config.get("use_compression"):
    cfg["compression_type"] = "scalar"
del legacy_config["use_compression"]

Type guard

def config_is_migrated(cfg: dict) -> bool:
    return "use_compression" not in cfg

Try / catch

try:
    Memory.from_config(config)
except ValueError as e:
    if "use_compression" in str(e):
        raise ConfigError("run the use_compression -> compression_type migration") from e
    raise

Prevention

When it happens

Trigger: Configuring the azure_ai_search vector store with use_compression=True or use_compression=False in the vector_store.provider.config dict (self-hosted Memory). Any presence of the key triggers it, even with the new compression_type also set.

Common situations: Upgrading mem0ai from an older release where use_compression was valid; copy-pasted YAML/JSON configs from old examples or blog posts; env-var-driven config templates that still include the flag.

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/b0750af40b6bb4b1. Report an issue: GitHub.