{"record":{"id":"4bbb1df5efee561c","repo":"chroma-core/chroma","slug":"unsupported-select-input","errorCode":null,"errorMessage":"Unsupported select input","messagePattern":"Unsupported select input","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/chromadb/src/execution/expression/select.ts","lineNumber":48,"sourceCode":"    }\n\n    if (input === null || input === undefined) {\n      return new Select();\n    }\n\n    if (Symbol.iterator in Object(input)) {\n      return new Select(input as Iterable<SelectKeyInput>);\n    }\n\n    if (\n      typeof input === \"object\" &&\n      \"keys\" in (input as Record<string, unknown>)\n    ) {\n      const { keys } = input as { keys?: Iterable<SelectKeyInput> };\n      return new Select(keys ?? []);\n    }\n\n    throw new TypeError(\"Unsupported select input\");\n  }\n\n  public static all(): Select {\n    return new Select([Key.DOCUMENT, Key.EMBEDDING, Key.METADATA, Key.SCORE]);\n  }\n\n  public get values(): string[] {\n    return this.keys.slice();\n  }\n\n  public toJSON(): { keys: string[] } {\n    return { keys: this.values };\n  }\n}\n","sourceCodeStart":30,"sourceCodeEnd":63,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/execution/expression/select.ts#L30-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst select = Select.from(payload.select); // payload.select = { fields: ['doc'] }\n\n// after\nconst select = Select.from(\n  Array.isArray(payload.select) ? payload.select : payload.select?.keys,\n);","handlingStrategy":"type-guard","validationCode":"const toSelectInput = (v: unknown) =>\n  v == null || Array.isArray(v) || typeof v === 'object'\n    ? v\n    : Select.all();\nconst select = Select.from(toSelectInput(payload.select));","typeGuard":"const isSelectInputLike = (v: unknown): v is SelectInput =>\n  v == null ||\n  v instanceof Select ||\n  (typeof v === 'object' &&\n    (Symbol.iterator in v || 'keys' in (v as Record<string, unknown>)));","tryCatchPattern":"try {\n  const select = Select.from(payload.select);\n} catch (e) {\n  if (e instanceof TypeError && e.message.includes('Unsupported select')) {\n    return new Select(); // empty = no explicit selection\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["select","input-validation","unsupported-input","client-side"],"backgroundTag":"unsupported-input-format","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}