{"record":{"id":"4ff8a4f4e6a352c4","repo":"FlowiseAI/Flowise","slug":"e-4ff8a4","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/Vectara/Vectara.ts","lineNumber":229,"sourceCode":"                for (const file of files) {\n                    if (!file) continue\n                    const splitDataURI = file.split(',')\n                    splitDataURI.pop()\n                    const bf = Buffer.from(splitDataURI.pop() || '', 'base64')\n                    const blob = new Blob([bf])\n                    vectaraFiles.push({ blob: blob, fileName: getFileName(file) })\n                }\n            }\n\n            try {\n                if (finalDocs.length) await VectaraStore.fromDocuments(finalDocs, embeddings, vectaraArgs)\n                if (vectaraFiles.length) {\n                    const vectorStore = new VectaraStore(vectaraArgs)\n                    await vectorStore.addFiles(vectaraFiles)\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        const credentialData = await getCredentialData(nodeData.credential ?? '', options)\n        const apiKey = getCredentialParam('apiKey', credentialData, nodeData)\n        const customerId = getCredentialParam('customerID', credentialData, nodeData)\n        const corpusId = getCredentialParam('corpusID', credentialData, nodeData).split(',')\n\n        const vectaraMetadataFilter = nodeData.inputs?.filter as string\n        const sentencesBefore = nodeData.inputs?.sentencesBefore as number\n        const sentencesAfter = nodeData.inputs?.sentencesAfter as number\n        const lambda = nodeData.inputs?.lambda as number\n        const output = nodeData.outputs?.output as string\n        const topK = nodeData.inputs?.topK as string\n        const k = topK ? parseFloat(topK) : 5\n        const mmrK = nodeData.inputs?.mmrK as number","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/Vectara/Vectara.ts#L211-L247","documentation":"Wraps any failure from VectaraStore.fromDocuments(finalDocs, ...) or vectorStore.addFiles(vectaraFiles) inside Vectara node init. The handler does `new Error(e)` on an already-Error value, so the original SDK error is stringified into the message (e.g. \"Error: <original>\") and its stack/name/.cause are lost. The real cause is whatever the Vectara REST/LangChain layer threw.","triggerScenarios":"Calling the Vectara node init with documents when VectaraStore.fromDocuments rejects (bad apiKey/customerID/corpusID in vectaraArgs, corpus not enabled, rate limited, network), or with files when vectorStore.addFiles rejects (unsupported file type, oversized blob, auth).","commonSituations":"Typo in Vectara credential (apiKey, customerID, wrong corpusID split), corpus not yet provisioned on the Vectara side, uploaded MIME/extension Vectara REST API rejects, expired API key, on-prem Vectara endpoint unreachable from the Flowise server.","solutions":["Read the literal text after \"Error:\" in the message — that is the flattened Vectara SDK error; address its underlying cause (auth, not-found, unsupported file, etc.).","Verify vectaraArgs credentials (apiKey, customerID, corpusID) against the Vectara console and confirm the corpus is enabled.","For addFiles failures, confirm the file type/size is supported by Vectara's file upload API.","Patch the wrapper to rethrow e unchanged: `throw e instanceof Error ? e : new Error(String(e))` so stack and cause survive."],"exampleFix":"// before\n} catch (e) {\n    throw new Error(e)\n}\n\n// after\n} catch (e) {\n    throw e instanceof Error ? e : new Error(String(e))\n}","handlingStrategy":"try-catch","validationCode":"// Pre-flight: verify Vectara credentials + corpus before init\nfunction validateVectaraArgs(args) {\n    if (!args.apiKey) throw new Error('Vectara apiKey missing')\n    if (!args.customerId) throw new Error('Vectara customerID missing')\n    if (!args.corpusId || corpusId.length === 0) throw new Error('Vectara corpusID missing')\n    if (finalDocs.length === 0 && vectaraFiles.length === 0) throw new Error('Nothing to ingest')\n}","typeGuard":"null","tryCatchPattern":"// Preserve the original SDK error; surface .cause for diagnostics\ntry {\n    if (finalDocs.length) await VectaraStore.fromDocuments(finalDocs, embeddings, vectaraArgs)\n    if (vectaraFiles.length) await new VectaraStore(vectaraArgs).addFiles(vectaraFiles)\n} catch (e) {\n    throw e instanceof Error ? e : new Error(String(e))\n}","preventionTips":["Never write `throw new Error(e)` on a caught Error — rethrow it or wrap with { cause }.","Pre-validate credentials (apiKey, customerID, corpusID) before calling the SDK.","Confirm file types are supported by Vectara's addFiles API before upload."],"tags":["vectara","vectorstore","error-wrapping","credentials"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}