{"record":{"id":"93fdd88caa6fa05f","repo":"chroma-core/chroma","slug":"deleting-sparse-vector-index-is-not-currently-supp","errorCode":null,"errorMessage":"Deleting sparse vector index is not currently supported.","messagePattern":"Deleting sparse vector index is not currently supported\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/chromadb/src/schema.ts","lineNumber":625,"sourceCode":"      );\n    }\n\n    // Disallow any key starting with # (except #document which allows FTS deletion)\n    if (keyProvided && key && key.startsWith(\"#\") && key !== DOCUMENT_KEY) {\n      throw new Error(\n        \"key cannot begin with '#'. Keys starting with '#' are reserved for system use.\",\n      );\n    }\n\n    // TODO: Consider removing these checks in the future to allow disabling vector and sparse vector indexes\n    // Temporarily disallow deleting vector index (both globally and per-key)\n    if (config instanceof VectorIndexConfig) {\n      throw new Error(\"Deleting vector index is not currently supported.\");\n    }\n\n    // Temporarily disallow deleting sparse vector index (both globally and per-key)\n    if (config instanceof SparseVectorIndexConfig) {\n      throw new Error(\n        \"Deleting sparse vector index is not currently supported.\",\n      );\n    }\n\n    // FTS deletion is only allowed on #document key\n    if (\n      config instanceof FtsIndexConfig &&\n      (!keyProvided || key !== DOCUMENT_KEY)\n    ) {\n      throw new Error(\"Deleting FTS index is only supported on #document key.\");\n    }\n\n    // TODO: Consider removing this check in the future to allow disabling all indexes for a key\n    // Disallow disabling all index types for a key (config=undefined, key=\"some_key\")\n    if (keyProvided && !configProvided && key) {\n      throw new Error(\n        `Cannot disable all index types for key '${key}'. Please specify a specific index configuration.`,\n      );","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/schema.ts#L607-L643","documentation":"The sparse-vector twin of the vector-delete restriction: deleting a sparse vector index is not currently supported in any form (globally or per-key). Any deleteIndex call whose config is a SparseVectorIndexConfig throws immediately; the only deletable index in this version is FTS on '#document'.","triggerScenarios":"schema.deleteIndex(new SparseVectorIndexConfig(), 'sparse_embedding'); reconfiguration workflows for hybrid search that delete-then-recreate sparse indexes.","commonSituations":"Hybrid (dense+sparse) search reconfiguration; teardown scripts written before checking which delete paths are actually supported.","solutions":["Recreate the collection with a schema that omits the sparse index, then re-ingest.","If you only need different parameters, apply a new SparseVectorIndexConfig via createIndex on the same key instead of deleting.","Version-gate teardown logic until the restriction (marked TODO in schema.ts) is lifted."],"exampleFix":"// before\nschema.deleteIndex(new SparseVectorIndexConfig(), 'sparse_embedding'); // throws\n\n// after\n// no delete API for sparse indexes yet — recreate the collection instead\nconst freshSchema = new Schema();\nawait client.createCollection({ name: name + '_v2', schema: freshSchema });","handlingStrategy":"fallback","validationCode":"function assertDeletableIndex(config: IndexConfig): void {\n  if (config instanceof SparseVectorIndexConfig) {\n    throw new Error('Sparse index deletion is unsupported — recreate the collection instead');\n  }\n}","typeGuard":"const isDeletableIndex = (config: IndexConfig): boolean =>\n  !(config instanceof SparseVectorIndexConfig);","tryCatchPattern":"try {\n  schema.deleteIndex(config, key);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Deleting sparse vector index is not currently supported.') {\n    // fall back: create a new collection without the sparse index and re-ingest\n  } else {\n    throw e;\n  }\n}","preventionTips":["Reconfigure sparse indexes via createIndex with a new SparseVectorIndexConfig rather than delete-then-recreate.","Version-gate teardown logic; the TODO in schema.ts indicates deletion support may be added later."],"tags":["schema","index-config","sparse-vector","unsupported-operation","chroma"],"backgroundTag":"unsupported-index-operation","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}