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 stringView on GitHub (pinned to abe4a8601a)
Solutions
- Verify the Milvus address is reachable and credentials are correct.
- Ensure the collection exists with a schema whose vector dim matches the embedding model.
- Confirm a vector index is built and the collection is loaded for upsert.
- 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
- Create the collection and build its index before the first upsert.
- Ensure the collection's vector dim equals the embedding model's output.
- Health-check the Milvus server before bulk operations.
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.