{"record":{"id":"59ad05b626134993","repo":"chroma-core/chroma","slug":"cannot-enable-all-index-types-for-key-key-pl","errorCode":null,"errorMessage":"Cannot enable all index types for key '${key}'. Please specify a specific index configuration.","messagePattern":"Cannot enable 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":570,"sourceCode":"    if (\n      config instanceof FtsIndexConfig &&\n      (!keyProvided || key !== DOCUMENT_KEY)\n    ) {\n      throw new Error(\n        \"FTS index can only be enabled on #document key. Use createIndex(new FtsIndexConfig(), '#document')\",\n      );\n    }\n\n    if (config instanceof SparseVectorIndexConfig && !keyProvided) {\n      throw new Error(\n        \"Sparse vector index must be created on a specific key. Please specify a key using: createIndex(new SparseVectorIndexConfig(...), 'your_key')\",\n      );\n    }\n\n    // TODO: Consider removing this check in the future to allow enabling all indexes for a key\n    // Disallow enabling all index types for a key (config=undefined, key=\"some_key\")\n    if (!configProvided && keyProvided && key) {\n      throw new Error(\n        `Cannot enable all index types for key '${key}'. Please specify a specific index configuration.`,\n      );\n    }\n\n    if (configProvided && !keyProvided) {\n      this.setIndexInDefaults(config as IndexConfig, true);\n    } else if (configProvided && keyProvided && key) {\n      this.setIndexForKey(key, config as IndexConfig, true);\n    }\n\n    return this;\n  }\n\n  deleteIndex(config?: IndexConfig, key?: string): this {\n    const configProvided = config !== undefined && config !== null;\n    const keyProvided = key !== undefined && key !== null;\n\n    if (!configProvided && !keyProvided) {","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/schema.ts#L552-L588","documentation":"The mirror image of the no-argument createIndex error: passing a key with no config would mean 'enable every index type for this key', which the schema API disallows (a TODO in the source notes this may be relaxed later). Each call must name a concrete IndexConfig. In this version the only grounded per-key configs are FtsIndexConfig on '#document' and SparseVectorIndexConfig on a user key.","triggerScenarios":"schema.createIndex(undefined, 'title'); schema.createIndex(null, 'title'); a ternary that yields an undefined config while the key is still passed.","commonSituations":"A SQL 'CREATE INDEX ON column' mental model where no index type is needed; optional config objects that fail a runtime condition; refactoring that moved the config argument away.","solutions":["Pick a concrete config for that key, e.g. createIndex(new SparseVectorIndexConfig(...), 'title').","If the intent was a global setting, pass the config without a key instead (e.g. a global VectorIndexConfig).","Guard optional paths: only call createIndex when you actually have a config to apply."],"exampleFix":"// before\nschema.createIndex(undefined, 'title');\n\n// after\nschema.createIndex(new SparseVectorIndexConfig(), 'title'); // concrete per-key config","handlingStrategy":"validation","validationCode":"function createIndexForKey(schema: Schema, config: IndexConfig | null | undefined, key: string): void {\n  if (config === undefined || config === null) {\n    throw new Error(`A concrete IndexConfig is required for key '${key}'`);\n  }\n  schema.createIndex(config, key);\n}","typeGuard":"const hasConcreteConfig = (config?: IndexConfig | null): config is IndexConfig =>\n  config !== undefined && config !== null;","tryCatchPattern":"try {\n  schema.createIndex(config, key);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Cannot enable all index types for key')) {\n    // choose a concrete config for the key and retry\n  } else {\n    throw e;\n  }\n}","preventionTips":["Make the config argument non-optional in your own createIndex wrapper for keyed indexes.","Remember key-only creation ('enable everything on this field') is intentionally blocked in this version."],"tags":["schema","index-config","chroma","typescript"],"backgroundTag":"invalid-index-configuration","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}