mem0ai/mem0 · error · ValueError

index_type must be either 'DELTA_SYNC' or 'DIRECT_ACCESS'

Error message

index_type must be either 'DELTA_SYNC' or 'DIRECT_ACCESS'

What it means

ValueError raised in Databricks index creation when self.index_type is neither VectorIndexType.DELTA_SYNC nor VectorIndexType.DIRECT_ACCESS. The value comes from the 'index_type' constructor/config argument; only those two Databricks Vector Search index types are supported, and the check runs after the source Delta table is ensured but before create_index is called.

Source

Thrown at mem0/vector_stores/databricks.py:322

        Returns:
            The index object.
        """
        # Determine index configuration
        embedding_dims = vector_size or self.embedding_dimension
        embedding_source_columns = [
            EmbeddingSourceColumn(
                name="memory",
                embedding_model_endpoint_name=self.embedding_model_endpoint_name,
            )
        ]

        logger.info(f"Creating vector search index '{self.fully_qualified_index_name}'")

        # First, ensure the source Delta table exists
        self._ensure_source_table_exists()

        if self.index_type not in [VectorIndexType.DELTA_SYNC, VectorIndexType.DIRECT_ACCESS]:
            raise ValueError("index_type must be either 'DELTA_SYNC' or 'DIRECT_ACCESS'")

        try:
            if self.index_type == VectorIndexType.DELTA_SYNC:
                index = self.client.vector_search_indexes.create_index(
                    name=self.fully_qualified_index_name,
                    endpoint_name=self.endpoint_name,
                    primary_key="memory_id",
                    index_type=self.index_type,
                    delta_sync_index_spec=DeltaSyncVectorIndexSpecRequest(
                        source_table=self.fully_qualified_table_name,
                        pipeline_type=self.pipeline_type,
                        columns_to_sync=self.column_names,
                        embedding_source_columns=embedding_source_columns,
                    ),
                )
                logger.info(
                    f"Successfully created vector search index '{self.fully_qualified_index_name}' with DELTA_SYNC type"
                )

View on GitHub (pinned to 001c235229)

Solutions

  1. Set index_type to exactly 'DELTA_SYNC' or 'DIRECT_ACCESS' (the values the store maps to VectorIndexType).
  2. Pick DELTA_SYNC when you want Databricks to sync from a Delta source table and auto-embed via a model endpoint; DIRECT_ACCESS when you write vectors yourself.
  3. Validate the value against {'DELTA_SYNC','DIRECT_ACCESS'} in your config loader before creating the store.

Example fix

# before
Databricks(..., index_type="delta_sync")  # ValueError

# after
Databricks(..., index_type="DELTA_SYNC")
Defensive patterns

Strategy: validation

Validate before calling

VALID_INDEX_TYPES = {"DELTA_SYNC", "DIRECT_ACCESS"}

if index_type not in VALID_INDEX_TYPES:
    raise ValueError(f"index_type must be one of {sorted(VALID_INDEX_TYPES)}, got {index_type!r}")

store = Databricks(..., index_type=index_type)

Type guard

from typing import Literal
IndexType = Literal["DELTA_SYNC", "DIRECT_ACCESS"]

def is_index_type(v) -> bool:
    return v in ("DELTA_SYNC", "DIRECT_ACCESS")

Prevention

When it happens

Trigger: Constructing the store with index_type='delta_sync' (lowercase, not matching the enum), an arbitrary string like 'HYBRID', or a VectorIndexType member that exists in the SDK but is not one of the two supported values.

Common situations: Config copied from Databricks docs using different casing; SDK version drift introducing/renaming enum members; hand-written YAML with a typo'd index_type.

Related errors


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