FlowiseAI/Flowise · error · Error

You must provide one of "ids or "filter".

Error message

You must provide one of "ids or "filter".

What it means

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.

Source

Thrown at packages/components/nodes/vectorstores/Chroma/core.ts:193

        return documentIds
    }

    /**
     * Deletes documents from the Chroma database. The documents to be deleted
     * can be specified by providing an array of `ids` or a `filter` object.
     * @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.
     * @returns A promise that resolves when the specified documents have been deleted from the database.
     */
    async delete(params: ChromaDeleteParams<this['FilterType']>): Promise<void> {
        const collection = await this.ensureCollection()
        if (Array.isArray(params.ids)) {
            await collection.delete({ ids: params.ids })
        } else if (params.filter) {
            await collection.delete({
                where: { ...params.filter }
            })
        } else {
            throw new Error(`You must provide one of "ids or "filter".`)
        }
    }

    /**
     * Searches for vectors in the Chroma database that are similar to the
     * provided query vector. The search can be filtered using the provided
     * `filter` object or the `filter` property of the `Chroma` instance.
     * @param query The query vector.
     * @param k The number of similar vectors to return.
     * @param filter Optional. A `filter` object to filter the search results.
     * @returns A promise that resolves with an array of tuples, each containing a `Document` instance and a similarity score.
     */
    async similaritySearchVectorWithScore(query: number[], k: number, filter?: this['FilterType']) {
        if (filter && this.filter) {
            throw new Error('cannot provide both `filter` and `this.filter`')
        }
        const _filter = filter ?? this.filter
        const where = _filter === undefined ? undefined : { ..._filter }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Always supply at least one of ids (string[]) or filter (object).
  2. Validate the params shape before calling delete.
  3. If ids is a string, split it into an array first.

Example fix

// before
await store.delete({ ids: someString }) // not an array -> falls through

// after
await store.delete({ ids: Array.isArray(someString) ? someString : [someString] })
Defensive patterns

Strategy: validation

Validate before calling

function buildDeleteParams(ids?: unknown, filter?: unknown) {
  const hasIds = Array.isArray(ids) && ids.length > 0
  const hasFilter = filter && typeof filter === 'object'
  if (!hasIds && !hasFilter) throw new Error('delete requires ids[] or filter')
  return hasIds ? { ids: ids as string[] } : { filter }
}
await store.delete(buildDeleteParams(rawIds, rawFilter))

Type guard

function isChromaDeleteParams(v: unknown): v is { ids: string[] } | { filter: Record<string, unknown> } {
  if (typeof v !== 'object' || v === null) return false
  const o = v as any
  return (Array.isArray(o.ids) && o.ids.length > 0) || (o.filter && typeof o.filter === 'object')
}

Try / catch

try {
  await store.delete(params)
} catch (e) {
  if (/must provide one of/i.test(String(e))) {
    throw new Error('Caller bug: delete called without ids or filter', { cause: e })
  }
  throw e
}

Prevention

When it happens

Trigger: Calling delete({}) or delete() with undefined for both fields, or passing ids as a non-array (so Array.isArray is false) and no filter.

Common situations: 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.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/1cea9ccb563a0f4a. Report an issue: GitHub.