{"record":{"id":"06778f59f05d1cc3","repo":"chroma-core/chroma","slug":"cannot-disable-all-index-types-for-key-key-p","errorCode":null,"errorMessage":"Cannot disable all index types for key '${key}'. Please specify a specific index configuration.","messagePattern":"Cannot disable all index types for key '(.+?)'\\. Please specify a specific index configuration\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/chromadb/src/schema.ts","lineNumber":641,"sourceCode":"    // 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      );\n    }\n\n    if (keyProvided && configProvided && key) {\n      this.setIndexForKey(key, config as IndexConfig, false);\n    } else if (!keyProvided && configProvided) {\n      this.setIndexInDefaults(config as IndexConfig, false);\n    }\n\n    return this;\n  }\n\n  serializeToJSON(): InternalSchema {\n    const defaults = this.serializeValueTypes(this.defaults);\n\n    const keys: Record<string, ValueTypesJson> = {};\n    for (const [keyName, valueTypes] of Object.entries(this.keys)) {","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/schema.ts#L623-L659","documentation":"Thrown by Schema.deleteIndex() when you supply only a key (config undefined/null) — i.e. you asked to disable ALL index types for that key at once. The schema API currently requires you to name the specific index configuration you want to turn off, so blanket 'delete everything on this key' is rejected (a TODO in the source notes this may be relaxed later).","triggerScenarios":"schema.deleteIndex(undefined, 'my_key') or schema.deleteIndex(null, 'title'). Fires when keyProvided && !configProvided && key (schema.ts:640).","commonSituations":"Coming from an ORM-style API where delete(key) removes all indexes on a column; trying to 'reset' a key to unindexed state in cleanup scripts between tests; iterating keys from schema serialization and calling deleteIndex for each without a config.","solutions":["Pass the specific config you want to disable, e.g. schema.deleteIndex(new StringInvertedIndexConfig(), 'my_key')","To disable several index types on one key, chain multiple deleteIndex calls, one per config class","To remove the key's overrides entirely, rebuild the schema without that key rather than blanket-disabling"],"exampleFix":"// before\nschema.deleteIndex(undefined, \"title\");\n// after\nschema.deleteIndex(new StringInvertedIndexConfig(), \"title\");\nschema.deleteIndex(new FtsIndexConfig(), \"#document\");","handlingStrategy":"validation","validationCode":"function assertDeleteIndexArgs(config, key) {\n  if ((config === undefined || config === null) && key) {\n    throw new TypeError(`deleteIndex needs a config for key '${key}'`);\n  }\n}","typeGuard":"const hasIndexConfig = (c) => c !== undefined && c !== null;","tryCatchPattern":"try { schema.deleteIndex(cfg, key); } catch (e) { if (e instanceof Error && /disable all index types/.test(e.message)) console.warn('Pass a specific IndexConfig to deleteIndex'); else throw e; }","preventionTips":["Never call deleteIndex with key only — always pair key with a config instance","Encapsulate schema mutations behind typed wrapper functions","Review the schema.ts guard list when upgrading the client, since the TODOs hint these restrictions may loosen"],"tags":["chromadb","schema","index-management","client-side-validation"],"backgroundTag":"invalid-index-configuration","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}