chroma-core/chroma · error · Error

Cannot enable all indexes for special key '${key}'. These ke

Error message

Cannot enable all indexes for special key '${key}'. These keys are managed automatically by the system.

What it means

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.

Source

Thrown at clients/new-js/packages/chromadb/src/schema.ts:821

      valueType.vectorIndex = new VectorIndexType(enabled, config);
    } else if (config instanceof IntInvertedIndexConfig) {
      const valueType = ensureIntValueType(current);
      valueType.intInvertedIndex = new IntInvertedIndexType(enabled, config);
    } else if (config instanceof FloatInvertedIndexConfig) {
      const valueType = ensureFloatValueType(current);
      valueType.floatInvertedIndex = new FloatInvertedIndexType(
        enabled,
        config,
      );
    } else if (config instanceof BoolInvertedIndexConfig) {
      const valueType = ensureBoolValueType(current);
      valueType.boolInvertedIndex = new BoolInvertedIndexType(enabled, config);
    }
  }

  private enableAllIndexesForKey(key: string): void {
    if (key === EMBEDDING_KEY || key === DOCUMENT_KEY) {
      throw new Error(
        `Cannot enable all indexes for special key '${key}'. These keys are managed automatically by the system.`,
      );
    }

    const current = (this.keys[key] = ensureValueTypes(this.keys[key]));
    current.string = new StringValueType(
      new FtsIndexType(true, new FtsIndexConfig()),
      new StringInvertedIndexType(true, new StringInvertedIndexConfig()),
    );
    current.floatList = new FloatListValueType(
      new VectorIndexType(true, new VectorIndexConfig()),
    );
    // Sparse vector indexes require both sourceKey and embeddingFunction,
    // so they cannot be auto-enabled and must be configured explicitly
    current.sparseVector = new SparseVectorValueType(
      new SparseVectorIndexType(false, new SparseVectorIndexConfig()),
    );
    current.intValue = new IntValueType(

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. Filter special keys out before bulk operations: skip '#embedding' and '#document'
  2. For '#document', enable/disable only the FTS index: schema.createIndex(new FtsIndexConfig(), '#document')
  3. For the vector index, configure it globally with schema.createIndex(new VectorIndexConfig()) and no key

Example fix

// before
for (const key of Object.keys(schema.keys)) {
  enableAllForKey(key); // throws on '#document' / '#embedding'
}
// after
const userKeys = Object.keys(schema.keys).filter(k => k !== '#document' && k !== '#embedding');
for (const key of userKeys) enableAllForKey(key);
Defensive patterns

Strategy: validation

Validate before calling

const SPECIAL_KEYS = new Set(["#embedding", "#document"]);
function isBulkIndexSafe(key) { return !SPECIAL_KEYS.has(key); }

Type guard

const isUserKey = (k) => k !== "#embedding" && k !== "#document" && !k.startsWith("#");

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/69419fff80796474. Report an issue: GitHub.