chroma-core/chroma · error · Error
Cannot disable all indexes. Must specify either config or…
Error message
Cannot disable all indexes. Must specify either config or key.
What it means
deleteIndex mirrors createIndex's argument contract: it needs an IndexConfig, a key, or both, because deleting every index in one call is not supported. Calling deleteIndex() with both arguments absent (undefined/null) throws immediately.
Solutions
- Delete a specific index: deleteIndex(new FtsIndexConfig(), '#document') for full-text search.
- For a full reset, recreate the collection with a fresh Schema instead of deleting every index.
- Guard optional deletes: if (cfg) schema.deleteIndex(cfg, key).
Example fix
// before schema.deleteIndex(); // after schema.deleteIndex(new FtsIndexConfig(), '#document'); // delete FTS specifically
Defensive patterns
Strategy: validation
Validate before calling
function deleteIndexSafe(schema: Schema, config?: IndexConfig | null, key?: string | null): void {
const hasConfig = config !== undefined && config !== null;
const hasKey = key !== undefined && key !== null;
if (!hasConfig && !hasKey) {
throw new Error('deleteIndex requires a config and/or a key — full teardown is not supported');
}
schema.deleteIndex(config ?? undefined, key ?? undefined);
} Type guard
const hasDeleteTarget = (config?: IndexConfig | null, key?: string | null): boolean => (config !== undefined && config !== null) || (key !== undefined && key !== null);
Try / catch
try {
schema.deleteIndex(config, key);
} catch (e) {
if (e instanceof Error && e.message === 'Cannot disable all indexes. Must specify either config or key.') {
// delete indexes individually instead of all at once
} else {
throw e;
}
} Prevention
- Treat teardown as per-index deletion; plan a recreate-collection path for full resets.
- Wrap deleteIndex so both-optional calls fail fast with your own clearer message.
When it happens
Trigger: schema.deleteIndex(); schema.deleteIndex(undefined, undefined); teardown/reset code that calls deleteIndex unconditionally with optional variables.
Common situations: Collection reset or teardown scripts; TypeScript allowing the call because both parameters are optional; copy-pasting a createIndex call and deleting an argument.
Related errors
- Cannot create index on special key
- Cannot create index on special key
- Cannot delete index on special key
- Cannot enable all index types for key
- Cannot enable all index types globally. Must specify either…
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/b66ac86c8f207120.
Report an issue: GitHub.
Appendix: source
Thrown at clients/new-js/packages/chromadb/src/schema.ts:589
`Cannot enable all index types for key '${key}'. Please specify a specific index configuration.`,
);
}
if (configProvided && !keyProvided) {
this.setIndexInDefaults(config as IndexConfig, true);
} else if (configProvided && keyProvided && key) {
this.setIndexForKey(key, config as IndexConfig, true);
}
return this;
}
deleteIndex(config?: IndexConfig, key?: string): this {
const configProvided = config !== undefined && config !== null;
const keyProvided = key !== undefined && key !== null;
if (!configProvided && !keyProvided) {
throw new Error(
"Cannot disable all indexes. Must specify either config or key.",
);
}
// Disallow using special internal key #embedding
if (keyProvided && key && key === EMBEDDING_KEY) {
throw new Error("Cannot modify #embedding. Currently not supported");
}
// Only allow #document with FtsIndexConfig (to disable FTS)
if (
keyProvided &&
key === DOCUMENT_KEY &&
!(config instanceof FtsIndexConfig)
) {
throw new Error(
`Cannot delete index on special key '${key}' with this config. Only FtsIndexConfig is allowed for #document.`,
);View on GitHub (pinned to aecdd12c8a)