{"record":{"id":"69419fff80796474","repo":"chroma-core/chroma","slug":"cannot-enable-all-indexes-for-special-key-key","errorCode":null,"errorMessage":"Cannot enable all indexes for special key '${key}'. These keys are managed automatically by the system.","messagePattern":"Cannot enable all indexes for special key '(.+?)'\\. These keys are managed automatically by the system\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/chromadb/src/schema.ts","lineNumber":821,"sourceCode":"      valueType.vectorIndex = new VectorIndexType(enabled, config);\n    } else if (config instanceof IntInvertedIndexConfig) {\n      const valueType = ensureIntValueType(current);\n      valueType.intInvertedIndex = new IntInvertedIndexType(enabled, config);\n    } else if (config instanceof FloatInvertedIndexConfig) {\n      const valueType = ensureFloatValueType(current);\n      valueType.floatInvertedIndex = new FloatInvertedIndexType(\n        enabled,\n        config,\n      );\n    } else if (config instanceof BoolInvertedIndexConfig) {\n      const valueType = ensureBoolValueType(current);\n      valueType.boolInvertedIndex = new BoolInvertedIndexType(enabled, config);\n    }\n  }\n\n  private enableAllIndexesForKey(key: string): void {\n    if (key === EMBEDDING_KEY || key === DOCUMENT_KEY) {\n      throw new Error(\n        `Cannot enable all indexes for special key '${key}'. These keys are managed automatically by the system.`,\n      );\n    }\n\n    const current = (this.keys[key] = ensureValueTypes(this.keys[key]));\n    current.string = new StringValueType(\n      new FtsIndexType(true, new FtsIndexConfig()),\n      new StringInvertedIndexType(true, new StringInvertedIndexConfig()),\n    );\n    current.floatList = new FloatListValueType(\n      new VectorIndexType(true, new VectorIndexConfig()),\n    );\n    // Sparse vector indexes require both sourceKey and embeddingFunction,\n    // so they cannot be auto-enabled and must be configured explicitly\n    current.sparseVector = new SparseVectorValueType(\n      new SparseVectorIndexType(false, new SparseVectorIndexConfig()),\n    );\n    current.intValue = new IntValueType(","sourceCodeStart":803,"sourceCodeEnd":839,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/schema.ts#L803-L839","documentation":"Thrown by the private Schema.enableAllIndexesForKey() helper when it is asked to bulk-enable every index type (FTS, string/int/float/bool inverted, vector, sparse) on the reserved '#embedding' or '#document' key. These special keys are managed by the system — '#document' only ever carries the FTS index and '#embedding' only the vector index — so blanket operations on them are illegal. Note: in the current public path createIndex(key-only) is rejected earlier with a different message, so hitting this exact text means an internal/future call path.","triggerScenarios":"Any code path that reaches enableAllIndexesForKey('#embedding') or enableAllIndexesForKey('#document') — e.g. a bulk 'index everything on this key' routine that loops over keys including the special ones, or future client versions that re-enable key-only createIndex.","commonSituations":"Writing generic tooling that iterates schema.keys and calls the enable-all helper on each; upgrading the client to a version where createIndex(undefined, key) is permitted again and passing '#document'; mixing user metadata keys with system keys in one list without filtering.","solutions":["Filter special keys out before bulk operations: skip '#embedding' and '#document'","For '#document', enable/disable only the FTS index: schema.createIndex(new FtsIndexConfig(), '#document')","For the vector index, configure it globally with schema.createIndex(new VectorIndexConfig()) and no key"],"exampleFix":"// before\nfor (const key of Object.keys(schema.keys)) {\n  enableAllForKey(key); // throws on '#document' / '#embedding'\n}\n// after\nconst userKeys = Object.keys(schema.keys).filter(k => k !== '#document' && k !== '#embedding');\nfor (const key of userKeys) enableAllForKey(key);","handlingStrategy":"validation","validationCode":"const SPECIAL_KEYS = new Set([\"#embedding\", \"#document\"]);\nfunction isBulkIndexSafe(key) { return !SPECIAL_KEYS.has(key); }","typeGuard":"const isUserKey = (k) => k !== \"#embedding\" && k !== \"#document\" && !k.startsWith(\"#\");","tryCatchPattern":"try { bulkEnable(key); } catch (e) { if (e instanceof Error && /managed automatically by the system/.test(e.message)) console.warn(`Skipped special key`); else throw e; }","preventionTips":["Maintain a blocklist of reserved keys at the boundary of your schema tooling","Filter schema.keys through isUserKey before bulk operations","Configure '#document' via FtsIndexConfig and vector search globally, never in bulk loops"],"tags":["chromadb","schema","index-management","reserved-keys"],"backgroundTag":"reserved-key-misuse","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}