FlowiseAI/Flowise · error · Error

Error searching data: ${JSON.stringify(searchResp)}

Error message

Error searching data: ${JSON.stringify(searchResp)}

What it means

Thrown by the Milvus vector store node after `client.search()` returns a response whose `status.error_code` is not `ErrorCode.SUCCESS`. The entire search response object is JSON-stringified into the message so the underlying Milvus server reason (e.g. collection not loaded, dimension mismatch, index error) is embedded in the string. It is the terminal failure of a similarity-search call, not a network error.

Source

Thrown at packages/components/nodes/vectorstores/Milvus/Milvus.ts:379

    const outputFields = vectorStore.fields.filter((field) => field !== vectorStore.vectorField)

    const search_params: any = {
        anns_field: vectorStore.vectorField,
        topk: k.toString(),
        metric_type: vectorStore.indexCreateParams.metric_type,
        params: JSON.stringify(vectorStore.indexSearchParams)
    }
    const searchResp = await vectorStore.client.search({
        collection_name: vectorStore.collectionName,
        search_params,
        output_fields: outputFields,
        vector_type: DataType.FloatVector,
        vectors: [query],
        filter: filterStr
    })
    if (searchResp.status.error_code !== ErrorCode.SUCCESS) {
        throw new Error(`Error searching data: ${JSON.stringify(searchResp)}`)
    }
    const results: [Document, number][] = []
    searchResp.results.forEach((result) => {
        const fields = {
            pageContent: '',
            metadata: {} as Record<string, any>
        }
        Object.keys(result).forEach((key) => {
            if (key === vectorStore.textField) {
                fields.pageContent = result[key]
            } else if (vectorStore.fields.includes(key) || key === vectorStore.primaryField) {
                if (typeof result[key] === 'string') {
                    const { isJson, obj } = checkJsonString(result[key])
                    fields.metadata[key] = isJson ? obj : result[key]
                } else {
                    fields.metadata[key] = result[key]
                }
            }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Inspect the JSON in the error message: read `status.reason` / `status.error_code` to get the exact Milvus failure cause.
  2. Ensure the collection is loaded: run `client.loadCollection({ collection_name })` and wait for it before searching.
  3. Verify the query vector dimension equals the collection schema's vector field dimension (compare `embeddings` model output length to the field definition).
  4. Confirm `metric_type` in `search_params` matches the index's `metric_type` (L2/IP/COSINE).
  5. Validate the filter string syntax against the currently-loaded Milvus SDK version.

Example fix

// before
if (searchResp.status.error_code !== ErrorCode.SUCCESS) {
    throw new Error(`Error searching data: ${JSON.stringify(searchResp)}`)
}
// after — surface the server reason for faster diagnosis
if (searchResp.status.error_code !== ErrorCode.SUCCESS) {
    throw new Error(
        `Milvus search failed (code=${searchResp.status.error_code}): ${searchResp.status.reason ?? JSON.stringify(searchResp)}`
    )
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before search: confirm collection is loaded and dims match
const dim = query.length
if (!Number.isInteger(dim) || dim <= 0) {
    throw new Error(`Invalid query vector dimension: ${dim}`)
}
const loadState = await vectorStore.client.getLoadState({ collection_name: vectorStore.collectionName })
if (loadState.state !== LoadState.Loaded) {
    throw new Error(`Collection '${vectorStore.collectionName}' is not loaded (state=${loadState.state})`)
}

Type guard

function isMilvusSuccess(resp: any): boolean {
  return resp?.status?.error_code === 0 || resp?.status?.error_code === 'Success'
}

Try / catch

try {
  const searchResp = await vectorStore.client.search({ /* ... */ })
  if (!isMilvusSuccess(searchResp)) throw new Error(`Milvus: ${searchResp.status.reason}`)
} catch (e) {
  // distinguish network vs server-returned error
  throw e instanceof Error ? e : new Error(`Milvus search network error: ${String(e)}`)
}

Prevention

When it happens

Trigger: Calling similarity search against a Milvus collection that is not loaded into memory, whose vector dimension does not match the query, whose index has been dropped, or whose `metric_type`/`search_params` disagree with the index. Also fires when the filter expression (`filterStr`) is malformed or references non-existent fields.

Common situations: Collection was created but never `loadCollectionSync`-ed (though this code calls it above, a prior failure can leave state inconsistent); query embedding model swapped to one with a different dimension; index dropped/recreated between upsert and search; wrong `topK` typed as a non-numeric string; expired Milvus credentials or zilliz cloud endpoint returning an auth error embedded in `status`.

Related errors


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