{"record":{"id":"cb0a3fa95ecccd89","repo":"cocoindex-io/cocoindex","slug":"unsupported-lancedb-vector-index-type-spec-index","errorCode":null,"errorMessage":"Unsupported LanceDB vector index type: {spec.index_type!r}. Supported types are 'ivf_pq' and 'hnsw_pq'.","messagePattern":"Unsupported LanceDB vector index type: (.+?)\\. Supported types are 'ivf_pq' and 'hnsw_pq'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/lancedb/_target.py","lineNumber":786,"sourceCode":"                        index_config_kwargs[\"num_partitions\"] = spec.num_partitions\n                    if spec.num_sub_vectors is not None:\n                        index_config_kwargs[\"num_sub_vectors\"] = spec.num_sub_vectors\n                    if spec.num_bits is not None:\n                        index_config_kwargs[\"num_bits\"] = spec.num_bits\n                    index_config = lancedb_index.IvfPq(**index_config_kwargs)\n                elif spec.index_type == \"hnsw_pq\":\n                    index_config_kwargs = {\"distance_type\": spec.metric}\n                    if spec.m is not None:\n                        index_config_kwargs[\"m\"] = spec.m\n                    if spec.ef_construction is not None:\n                        index_config_kwargs[\"ef_construction\"] = spec.ef_construction\n                    if spec.num_sub_vectors is not None:\n                        index_config_kwargs[\"num_sub_vectors\"] = spec.num_sub_vectors\n                    if spec.num_bits is not None:\n                        index_config_kwargs[\"num_bits\"] = spec.num_bits\n                    index_config = lancedb_index.HnswPq(**index_config_kwargs)\n                else:\n                    raise ValueError(\n                        f\"Unsupported LanceDB vector index type: {spec.index_type!r}. \"\n                        \"Supported types are 'ivf_pq' and 'hnsw_pq'.\"\n                    )\n                await table.create_index(\n                    spec.column,\n                    config=index_config,\n                    replace=True,\n                    name=action.name,\n                )\n\n    def reconcile(\n        self,\n        key: coco.StableKey,\n        desired_state: _VectorIndexSpec | coco.NonExistenceType,\n        prev_possible_records: Collection[_VectorIndexFingerprint],\n        prev_may_be_missing: bool,\n        /,\n    ) -> coco.TargetReconcileOutput[_VectorIndexAction, _VectorIndexFingerprint] | None:","sourceCodeStart":768,"sourceCodeEnd":804,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/lancedb/_target.py#L768-L804","documentation":"When applying declared index actions, the vector index spec's index_type must be one of the supported LanceDB index configs: 'ivf_pq' or 'hnsw_pq'. Any other string has no corresponding lancedb.index config class, so a ValueError lists the supported values.","triggerScenarios":"Declaring a vector index with `index_type` set to something else (e.g. 'ivf_flat', 'btree', 'HNSW', or a typo) so that _apply_actions falls through both known branches.","commonSituations":"Copying index type names from LanceDB docs that include variants CocoIndex doesn't expose; case mismatch ('IVF_PQ'); older/newer naming from other vector stores.","solutions":["Change the index spec to index_type=\"ivf_pq\" or \"hnsw_pq\".","Fix casing — the comparison is against lowercase literal names.","If you need another LanceDB index type, check the connector version/docs for support rather than guessing a name."],"exampleFix":"// before\nVectorIndexSpec(column=\"embedding\", index_type=\"ivf_flat\", ...)\n// after\nVectorIndexSpec(column=\"embedding\", index_type=\"ivf_pq\", ...)","handlingStrategy":"validation","validationCode":"SUPPORTED = {\"ivf_pq\", \"hnsw_pq\"}\nassert spec.index_type in SUPPORTED, f\"index_type must be one of {SUPPORTED}, got {spec.index_type!r}\"","typeGuard":null,"tryCatchPattern":"try:\n    await app.update()\nexcept ValueError as e:\n    if \"Unsupported LanceDB vector index type\" in str(e):\n        ...  # fix spec.index_type to 'ivf_pq' or 'hnsw_pq'\n    raise","preventionTips":["Only use 'ivf_pq' or 'hnsw_pq' string literals for index_type.","Define index specs via constants/enums to avoid typos.","Check the connector's supported list when upgrading LanceDB."],"tags":["python","lancedb","index","invalid-enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}