mem0ai/mem0 · error · ValueError

Host must be provided for OpenSearch

Error message

Host must be provided for OpenSearch

What it means

Error "Host must be provided for OpenSearch" thrown in mem0ai/mem0.

Source

Thrown at mem0/configs/vector_stores/opensearch.py:33

    use_ssl: bool = Field(False, description="Use SSL for connection (default False for OpenSearch)")
    http_auth: Optional[object] = Field(None, description="HTTP authentication method / AWS SigV4")
    connection_class: Optional[Union[str, Type]] = Field(
        "RequestsHttpConnection", description="Connection class for OpenSearch"
    )
    pool_maxsize: int = Field(20, description="Maximum number of connections in the pool")
    auto_refresh: bool = Field(
        False,
        description="Automatically refresh index after insert operations to make documents "
        "immediately searchable. Disabled by default for OpenSearch Serverless compatibility. "
        "OpenSearch automatically refreshes indices every ~1 second, so most users don't need this.",
    )

    @model_validator(mode="before")
    @classmethod
    def validate_auth(cls, values: Dict[str, Any]) -> Dict[str, Any]:
        # Check if host is provided
        if not values.get("host"):
            raise ValueError("Host must be provided for OpenSearch")

        return values

    @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
        if extra_fields:
            raise ValueError(
                f"Extra fields not allowed: {', '.join(extra_fields)}. Allowed fields: {', '.join(allowed_fields)}"
            )
        return values

    model_config = ConfigDict(arbitrary_types_allowed=True)

View on GitHub (pinned to 001c235229)

Solutions

  1. Set host in the OpenSearch config (and port, user, password as needed).

When it happens

Trigger: Thrown at mem0/configs/vector_stores/opensearch.py:33 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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