{"record":{"id":"c41a18490fc7d18c","repo":"FlowiseAI/Flowise","slug":"e-c41a18","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Milvus/Milvus.ts","lineNumber":241,"sourceCode":"                if (flattenDocs[i] && flattenDocs[i].pageContent) {\n                    if (isFileUploadEnabled && options.chatId) {\n                        flattenDocs[i].metadata = { ...flattenDocs[i].metadata, [FLOWISE_CHATID]: options.chatId }\n                    }\n                    finalDocs.push(new Document(flattenDocs[i]))\n                }\n            }\n\n            try {\n                const vectorStore = await MilvusUpsert.fromDocuments(finalDocs, embeddings, milVusArgs)\n\n                // Avoid Illegal Invocation\n                vectorStore.similaritySearchVectorWithScore = async (query: number[], k: number, filter?: string) => {\n                    return await similaritySearchVectorWithScore(query, k, vectorStore, undefined, filter)\n                }\n\n                return { numAdded: finalDocs.length, addedDocs: finalDocs }\n            } catch (e) {\n                throw new Error(e)\n            }\n        }\n    }\n\n    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {\n        // server setup\n        const address = nodeData.inputs?.milvusServerUrl as string\n        const collectionName = nodeData.inputs?.milvusCollection as string\n        const _milvusFilter = nodeData.inputs?.milvusFilter as string\n        const textField = nodeData.inputs?.milvusTextField as string\n        const isFileUploadEnabled = nodeData.inputs?.fileUpload as boolean\n\n        // embeddings\n        const embeddings = nodeData.inputs?.embeddings as Embeddings\n        const topK = nodeData.inputs?.topK as string\n\n        // output\n        const output = nodeData.outputs?.output as string","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Milvus/Milvus.ts#L223-L259","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n} catch (e) {\n    throw new Error(e)\n}\n\n// after\n} catch (e) {\n    console.error('Milvus fromDocuments failed', e)\n    throw e\n}","handlingStrategy":"try-catch","validationCode":"const hasCol = await milvusClient.hasCollection({ collection_name: collectionName })\nif (!hasCol.value) throw new Error(`Collection ${collectionName} missing; create before upsert`)\n// confirm dims match schema\nconst desc = await milvusClient.describeCollection({ collection_name: collectionName })\nconst vecField = desc.schema.fields.find(f => f.data_type === 'FloatVector')\nif (vecField && vecField.params?.dim !== String(EMBEDDING_DIM)) {\n  throw new Error(`Schema dim ${vecField.params.dim} != embedding ${EMBEDDING_DIM}`)\n}","typeGuard":"function isMilvusReachable(client: { checkHealth(): Promise<{ isHealthy: boolean }> }): Promise<boolean> {\n  return client.checkHealth().then(r => r.isHealthy).catch(() => false)\n}","tryCatchPattern":"try {\n  await MilvusUpsert.fromDocuments(finalDocs, embeddings, milVusArgs)\n} catch (e) {\n  throw new Error(`Milvus upsert failed (coll=${collectionName}, addr=${address}): ${e instanceof Error ? e.message : e}`)\n}","preventionTips":["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."],"tags":["milvus","vector-store","error-wrapping","upsert"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}