{"record":{"id":"59c2b29198db2b1d","repo":"chroma-core/chroma","slug":"cannot-delete-index-on-special-key-key-with-t","errorCode":null,"errorMessage":"Cannot delete index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.","messagePattern":"Cannot delete index on special key '(.+?)' with this config\\. Only FtsIndexConfig is allowed for #document\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/chromadb/src/schema.ts","lineNumber":605,"sourceCode":"\n    if (!configProvided && !keyProvided) {\n      throw new Error(\n        \"Cannot disable all indexes. Must specify either config or key.\",\n      );\n    }\n\n    // Disallow using special internal key #embedding\n    if (keyProvided && key && key === EMBEDDING_KEY) {\n      throw new Error(\"Cannot modify #embedding. Currently not supported\");\n    }\n\n    // Only allow #document with FtsIndexConfig (to disable FTS)\n    if (\n      keyProvided &&\n      key === DOCUMENT_KEY &&\n      !(config instanceof FtsIndexConfig)\n    ) {\n      throw new Error(\n        `Cannot delete index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`,\n      );\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)","sourceCodeStart":587,"sourceCodeEnd":623,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/schema.ts#L587-L623","documentation":"The delete-side twin of the '#document' creation rule: on '#document' the only index that exists — and can be deleted — is full-text search, so deleteIndex targeting '#document' must pass an FtsIndexConfig. Any other config (including undefined) paired with '#document' throws, because undefined fails the instanceof FtsIndexConfig check.","triggerScenarios":"schema.deleteIndex(new VectorIndexConfig(), '#document'); schema.deleteIndex(undefined, '#document'); schema.deleteIndex(new SparseVectorIndexConfig(), '#document').","commonSituations":"Trying to delete 'the document index' generically without naming FTS; reusing createIndex argument patterns for deletion; assuming key-only deletion works for system keys.","solutions":["Use deleteIndex(new FtsIndexConfig(), '#document') to disable full-text search.","Always pass the config explicitly for '#document' — key-only deletion is not accepted there."],"exampleFix":"// before\nschema.deleteIndex(undefined, '#document');\n\n// after\nschema.deleteIndex(new FtsIndexConfig(), '#document');","handlingStrategy":"validation","validationCode":"function disableFts(schema: Schema): void {\n  schema.deleteIndex(new FtsIndexConfig(), '#document');\n}","typeGuard":"const isDocumentFtsDelete = (config: IndexConfig | undefined, key?: string | null): boolean =>\n  config instanceof FtsIndexConfig && key === '#document';","tryCatchPattern":"try {\n  schema.deleteIndex(config, '#document');\n} catch (e) {\n  if (e instanceof Error && e.message.includes('Only FtsIndexConfig is allowed for #document')) {\n    schema.deleteIndex(new FtsIndexConfig(), '#document'); // retry with FTS config\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always pass an explicit FtsIndexConfig when targeting '#document' in deleteIndex.","Centralize '#document' handling in enable/disable FTS helpers."],"tags":["schema","index-config","full-text-search","chroma"],"backgroundTag":"invalid-index-configuration","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}