chroma-core/chroma · error · TypeError
Unsupported select input
Error message
Unsupported select input
What it means
Thrown by Select.from (select.ts:48) when the input is a shape the parser does not recognize: not a Select instance, not null/undefined, not an iterable, and not an object with a `keys` property. Note the subtlety: a plain string IS iterable, so Select.from('doc') does not throw — it silently becomes Select(['d','o','c']). This error is reserved for primitives (numbers, booleans), functions, and objects lacking both Symbol.iterator and keys.
Source
Thrown at clients/new-js/packages/chromadb/src/execution/expression/select.ts:48
}
if (input === null || input === undefined) {
return new Select();
}
if (Symbol.iterator in Object(input)) {
return new Select(input as Iterable<SelectKeyInput>);
}
if (
typeof input === "object" &&
"keys" in (input as Record<string, unknown>)
) {
const { keys } = input as { keys?: Iterable<SelectKeyInput> };
return new Select(keys ?? []);
}
throw new TypeError("Unsupported select input");
}
public static all(): Select {
return new Select([Key.DOCUMENT, Key.EMBEDDING, Key.METADATA, Key.SCORE]);
}
public get values(): string[] {
return this.keys.slice();
}
public toJSON(): { keys: string[] } {
return { keys: this.values };
}
}
View on GitHub (pinned to aecdd12c8a)
Solutions
- Pass an array of string/Key entries: Select.from(['#document'])
- Or the wrapper object with the exact `keys` property: Select.from({ keys: ['#document'] })
- For 'select everything' use Select.all() or pass null/undefined (empty Select)
- Validate external input before handing it to Select.from
Example fix
// before
const select = Select.from(payload.select); // payload.select = { fields: ['doc'] }
// after
const select = Select.from(
Array.isArray(payload.select) ? payload.select : payload.select?.keys,
); Defensive patterns
Strategy: type-guard
Validate before calling
const toSelectInput = (v: unknown) =>
v == null || Array.isArray(v) || typeof v === 'object'
? v
: Select.all();
const select = Select.from(toSelectInput(payload.select)); Type guard
const isSelectInputLike = (v: unknown): v is SelectInput =>
v == null ||
v instanceof Select ||
(typeof v === 'object' &&
(Symbol.iterator in v || 'keys' in (v as Record<string, unknown>))); Try / catch
try {
const select = Select.from(payload.select);
} catch (e) {
if (e instanceof TypeError && e.message.includes('Unsupported select')) {
return new Select(); // empty = no explicit selection
}
throw e;
} Prevention
- Pass an array of keys or exactly { keys: [...] } — the property must be named `keys`
- Beware: strings are iterable, so Select.from('doc') becomes ['d','o','c'] without an error
- Use Select.all() or null for 'select everything', never a boolean flag
When it happens
Trigger: Select.from(42); Select.from(true); Select.from(() => {}); Select.from({ fields: ['a'] }) — wrong property name, must be `keys`; passing a parsed JSON value that is a number or boolean instead of the expected object.
Common situations: API/config payload drift where `select` is expected to be an array or {keys: [...]} but arrives as a scalar; typos in the wrapper property (fields/columns instead of keys); passing a Boolean flag meaning 'select all' instead of Select.all() or null.
Related errors
- Select keys must be strings or Key instances
- Knn limit must be a positive integer
- Knn key must be a string or Key instance
- Rrf k must be a positive integer
- Where input must be a WhereExpression or plain object
AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16).
Data as JSON: /api/errors/4bbb1df5efee561c.
Report an issue: GitHub.