{"record":{"id":"350f0d4e7459ad3e","repo":"chroma-core/chroma","slug":"expected-include-items-to-be-one-of-validvalue","errorCode":null,"errorMessage":"Expected 'include' items to be one of ${validValues.join(\", \")}, but got ${item}","messagePattern":"Expected 'include' items to be one of (.+?), but got (.+?)","errorType":"validation","errorClass":"ChromaValueError","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/chromadb/src/utils.ts","lineNumber":734,"sourceCode":"export const validateInclude = ({\n  include,\n  exclude,\n}: {\n  include: Include[];\n  exclude?: Include[];\n}) => {\n  if (!Array.isArray(include)) {\n    throw new ChromaValueError(\"Expected 'include' to be a non-empty array\");\n  }\n\n  const validValues = Object.keys(IncludeEnum);\n  include.forEach((item) => {\n    if (typeof (item as any) !== \"string\") {\n      throw new ChromaValueError(\"Expected 'include' items to be strings\");\n    }\n\n    if (!validValues.includes(item)) {\n      throw new ChromaValueError(\n        `Expected 'include' items to be one of ${validValues.join(\n          \", \",\n        )}, but got ${item}`,\n      );\n    }\n\n    if (exclude?.includes(item)) {\n      throw new ChromaValueError(`${item} is not allowed for this operation`);\n    }\n  });\n};\n\n/**\n * Validates the number of results parameter for queries.\n * @param nResults - Number of results to validate\n * @throws ChromaValueError if nResults is not a positive number\n */\nexport const validateNResults = (nResults: number) => {","sourceCodeStart":716,"sourceCodeEnd":752,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/chromadb/src/utils.ts#L716-L752","documentation":"Include items must be one of the IncludeEnum keys — documents, embeddings, metadatas, distances, uris (types.ts:183-194; the message interpolates Object.keys(IncludeEnum)). Anything else throws this ChromaValueError listing the valid values (utils.ts:733-739). 'ids' is not includeable because ids are always returned.","triggerScenarios":"include: ['ids']; include: ['metadata'] (singular); include: ['content'] or ['data'] — against collection.get() or collection.query().","commonSituations":"Assuming ids must be requested explicitly; singular/plural typos; porting code from another vector store with different result-field names.","solutions":["Use exactly the plural forms: documents, embeddings, metadatas, distances, uris","Reference IncludeEnum members instead of hand-typed strings","Remove 'ids' from the list — ids are always included in results"],"exampleFix":"// before\nawait col.get({ include: ['ids', 'metadata'] });\n\n// after\nawait col.get({ include: ['metadatas'] }); // ids always returned","handlingStrategy":"validation","validationCode":"import { IncludeEnum } from 'chromadb';\nconst VALID_INCLUDE = Object.keys(IncludeEnum); // ['distances','documents','embeddings','metadatas','uris']\nconst safeInclude = requested.filter(f => VALID_INCLUDE.includes(f));\nif (safeInclude.length === 0) safeInclude.push('documents');\nawait col.get({ include: safeInclude });","typeGuard":"import { IncludeEnum, type Include } from 'chromadb';\nconst isIncludeValue = (v: unknown): v is Include =>\n  typeof v === 'string' && Object.values(IncludeEnum).includes(v as IncludeEnum);","tryCatchPattern":null,"preventionTips":["Reference IncludeEnum members instead of hand-typed strings","Remember ids are always returned and are not an include value","Use the exact plural field names from the IncludeEnum keys"],"tags":["javascript","typescript","validation","include","enum"],"backgroundTag":"invalid-include-parameter","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}