FlowiseAI/Flowise · error · Error

${e}

Error message

${e}

What it means

Generic catch-all around MilvusUpsert.fromDocuments(finalDocs, embeddings, milVusArgs) in the upsert path, plus the similaritySearchVectorWithScore reassignment to avoid illegal invocation. Wraps any Milvus/embedding failure into a string Error.

Source

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

                if (flattenDocs[i] && flattenDocs[i].pageContent) {
                    if (isFileUploadEnabled && options.chatId) {
                        flattenDocs[i].metadata = { ...flattenDocs[i].metadata, [FLOWISE_CHATID]: options.chatId }
                    }
                    finalDocs.push(new Document(flattenDocs[i]))
                }
            }

            try {
                const vectorStore = await MilvusUpsert.fromDocuments(finalDocs, embeddings, milVusArgs)

                // Avoid Illegal Invocation
                vectorStore.similaritySearchVectorWithScore = async (query: number[], k: number, filter?: string) => {
                    return await similaritySearchVectorWithScore(query, k, vectorStore, undefined, filter)
                }

                return { numAdded: finalDocs.length, addedDocs: finalDocs }
            } catch (e) {
                throw new Error(e)
            }
        }
    }

    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
        // server setup
        const address = nodeData.inputs?.milvusServerUrl as string
        const collectionName = nodeData.inputs?.milvusCollection as string
        const _milvusFilter = nodeData.inputs?.milvusFilter as string
        const textField = nodeData.inputs?.milvusTextField as string
        const isFileUploadEnabled = nodeData.inputs?.fileUpload as boolean

        // embeddings
        const embeddings = nodeData.inputs?.embeddings as Embeddings
        const topK = nodeData.inputs?.topK as string

        // output
        const output = nodeData.outputs?.output as string

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Verify the Milvus address is reachable and credentials are correct.
  2. Ensure the collection exists with a schema whose vector dim matches the embedding model.
  3. Confirm a vector index is built and the collection is loaded for upsert.
  4. Rethrow `e` directly to preserve the @zilliz/milvus2-sdk-node error.

Example fix

// before
} catch (e) {
    throw new Error(e)
}

// after
} catch (e) {
    console.error('Milvus fromDocuments failed', e)
    throw e
}
Defensive patterns

Strategy: try-catch

Validate before calling

const hasCol = await milvusClient.hasCollection({ collection_name: collectionName })
if (!hasCol.value) throw new Error(`Collection ${collectionName} missing; create before upsert`)
// confirm dims match schema
const desc = await milvusClient.describeCollection({ collection_name: collectionName })
const vecField = desc.schema.fields.find(f => f.data_type === 'FloatVector')
if (vecField && vecField.params?.dim !== String(EMBEDDING_DIM)) {
  throw new Error(`Schema dim ${vecField.params.dim} != embedding ${EMBEDDING_DIM}`)
}

Type guard

function isMilvusReachable(client: { checkHealth(): Promise<{ isHealthy: boolean }> }): Promise<boolean> {
  return client.checkHealth().then(r => r.isHealthy).catch(() => false)
}

Try / catch

try {
  await MilvusUpsert.fromDocuments(finalDocs, embeddings, milVusArgs)
} catch (e) {
  throw new Error(`Milvus upsert failed (coll=${collectionName}, addr=${address}): ${e instanceof Error ? e.message : e}`)
}

Prevention

When it happens

Trigger: Upsert documents into Milvus with configured milVusArgs (address, collection, textField, dimensions). Fails on Milvus server unreachable, collection not existing, dimension mismatch, auth errors, or embedding service failures.

Common situations: Milvus server URL wrong or down, collection not created before upsert, dimension field mismatch between collection schema and embedding model, or missing index on the vector field.

Related errors


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