{"record":{"id":"1cea9ccb563a0f4a","repo":"FlowiseAI/Flowise","slug":"you-must-provide-one-of-ids-or-filter","errorCode":null,"errorMessage":"You must provide one of \"ids or \"filter\".","messagePattern":"You must provide one of \"ids or \"filter\"\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Chroma/core.ts","lineNumber":193,"sourceCode":"        return documentIds\n    }\n\n    /**\n     * Deletes documents from the Chroma database. The documents to be deleted\n     * can be specified by providing an array of `ids` or a `filter` object.\n     * @param params An object containing either an array of `ids` of the documents to be deleted or a `filter` object to specify the documents to be deleted.\n     * @returns A promise that resolves when the specified documents have been deleted from the database.\n     */\n    async delete(params: ChromaDeleteParams<this['FilterType']>): Promise<void> {\n        const collection = await this.ensureCollection()\n        if (Array.isArray(params.ids)) {\n            await collection.delete({ ids: params.ids })\n        } else if (params.filter) {\n            await collection.delete({\n                where: { ...params.filter }\n            })\n        } else {\n            throw new Error(`You must provide one of \"ids or \"filter\".`)\n        }\n    }\n\n    /**\n     * Searches for vectors in the Chroma database that are similar to the\n     * provided query vector. The search can be filtered using the provided\n     * `filter` object or the `filter` property of the `Chroma` instance.\n     * @param query The query vector.\n     * @param k The number of similar vectors to return.\n     * @param filter Optional. A `filter` object to filter the search results.\n     * @returns A promise that resolves with an array of tuples, each containing a `Document` instance and a similarity score.\n     */\n    async similaritySearchVectorWithScore(query: number[], k: number, filter?: this['FilterType']) {\n        if (filter && this.filter) {\n            throw new Error('cannot provide both `filter` and `this.filter`')\n        }\n        const _filter = filter ?? this.filter\n        const where = _filter === undefined ? undefined : { ..._filter }","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Chroma/core.ts#L175-L211","documentation":"delete() requires either params.ids (an array) or params.filter; providing neither is a contract violation. The method has no default and refuses to delete the entire collection by accident.","triggerScenarios":"Calling delete({}) or delete() with undefined for both fields, or passing ids as a non-array (so Array.isArray is false) and no filter.","commonSituations":"Caller builds the params object conditionally and both branches leave it empty; passing ids as a comma string instead of an array; misconfigured upstream node emitting an empty payload.","solutions":["Always supply at least one of ids (string[]) or filter (object).","Validate the params shape before calling delete.","If ids is a string, split it into an array first."],"exampleFix":"// before\nawait store.delete({ ids: someString }) // not an array -> falls through\n\n// after\nawait store.delete({ ids: Array.isArray(someString) ? someString : [someString] })","handlingStrategy":"validation","validationCode":"function buildDeleteParams(ids?: unknown, filter?: unknown) {\n  const hasIds = Array.isArray(ids) && ids.length > 0\n  const hasFilter = filter && typeof filter === 'object'\n  if (!hasIds && !hasFilter) throw new Error('delete requires ids[] or filter')\n  return hasIds ? { ids: ids as string[] } : { filter }\n}\nawait store.delete(buildDeleteParams(rawIds, rawFilter))","typeGuard":"function isChromaDeleteParams(v: unknown): v is { ids: string[] } | { filter: Record<string, unknown> } {\n  if (typeof v !== 'object' || v === null) return false\n  const o = v as any\n  return (Array.isArray(o.ids) && o.ids.length > 0) || (o.filter && typeof o.filter === 'object')\n}","tryCatchPattern":"try {\n  await store.delete(params)\n} catch (e) {\n  if (/must provide one of/i.test(String(e))) {\n    throw new Error('Caller bug: delete called without ids or filter', { cause: e })\n  }\n  throw e\n}","preventionTips":["Always normalize ids to a string[] before passing.","Treat the delete payload as required input, validate at the boundary.","Document which of ids/filter your code path supplies."],"tags":["chroma","delete","validation","api-contract"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}