lancedb/lancedb · error · ValueError
Unknown index type
Error message
Unknown index type {index_type} What it means
The legacy create_index path dispatches on index_type and only supports the recognized vector index variants (IVF_PQ, IVF_HNSW_PQ, etc.); anything else raises ValueError('Unknown index type {index_type}').
Solutions
- Use one of the accepted index_type strings (e.g. "IVF_PQ", "IVF_HNSW_PQ", "IVF_HNSW_SQ").
- Prefer the config-based API: table.create_index(column, config=IvfPq(...)) instead of index_type strings.
- For scalar indexes use BTree/Bitmap/LabelList configs with create_index(column=...).
- Check the signature/docs of your installed lancedb version; index_type names changed over releases.
Example fix
// before
table.create_index(num_partitions=16, index_type="IVFPQ")
// after
from lancedb.index import IvfPq
table.create_index(metric="L2", vector_column_name="vector",
index_type="IVF_PQ")
# or config-based:
table.create_index(config=IvfPq(num_partitions=16)) Defensive patterns
Strategy: validation
Validate before calling
ALLOWED = {"IVF_PQ", "IVF_HNSW_PQ", "IVF_HNSW_SQ"}
if index_type not in ALLOWED:
raise ValueError(f"index_type must be one of {ALLOWED}") Try / catch
try:
table.create_index(index_type=index_type, ...)
except ValueError as e:
if "Unknown index type" in str(e):
logger.error(f"Unsupported index_type: {index_type}") Prevention
- Prefer config objects (IvfPq etc.) over raw index_type strings.
- Keep index_type values in a validated enum/constants module.
- Check the docs for your installed lancedb version.
When it happens
Trigger: Calling table.create_index(metric=..., vector_column_name=..., index_type=X) where X is not one of the accepted strings (e.g. 'IVFPQ', 'hnsw', lowercase 'ivf_pq', or a scalar type like 'BTREE' on this legacy path).
Common situations: Copy-pasted index_type from another library (FAISS/pgvector style); case mistakes; trying to create a scalar index (BTREE/BITMAP/LABEL_LIST) through the legacy vector API instead of the config-based create_index.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Cannot select column
- config must be an instance of IvfSq, IvfPq, IvfRq, HnswPq…
- Either data or schema is required for server-side…
- fragments and fragment_ids cannot both be set
- Invalid format
AI-assisted analysis of lancedb/lancedb@c7b051aff7 (2026-09-08).
Data as JSON: /api/errors/b153f6f9a387c9b5.
Report an issue: GitHub.
Appendix: source
Thrown at python/python/lancedb/table.py:3326
max_iterations=max_iterations,
sample_rate=sample_rate,
m=m,
ef_construction=ef_construction,
target_partition_size=target_partition_size,
accelerator=accelerator,
)
elif index_type == "IVF_HNSW_FLAT":
return HnswFlat(
distance_type=metric,
num_partitions=num_partitions,
max_iterations=max_iterations,
sample_rate=sample_rate,
m=m,
ef_construction=ef_construction,
target_partition_size=target_partition_size,
)
else:
raise ValueError(f"Unknown index type {index_type}")
def drop_index(self, name: str) -> None:
"""
Drops an index from the table
Parameters
----------
name: str
The name of the index to drop
"""
return LOOP.run(self._table.drop_index(name))
def prewarm_index(self, name: str) -> None:
"""
Prewarm an index in the table.
This is a hint to the database that the index will be accessed in the
future and should be loaded into memory if possible. This can reduceView on GitHub (pinned to c7b051aff7)