{"record":{"id":"b43e1043e7af5456","repo":"FlowiseAI/Flowise","slug":"e-b43e10","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/SimpleStore/SimpleStore.ts","lineNumber":111,"sourceCode":"            for (let i = 0; i < flattenDocs.length; i += 1) {\n                finalDocs.push(new LCDocument(flattenDocs[i]))\n            }\n\n            const llamadocs: Document[] = []\n            for (const doc of finalDocs) {\n                llamadocs.push(new Document({ text: doc.pageContent, metadata: doc.metadata }))\n            }\n\n            const serviceContext = serviceContextFromDefaults({ llm: model, embedModel: embeddings })\n            // Validate and sanitize the base path to prevent path traversal attacks\n            const filePath = validateVectorStorePath(basePath)\n            const storageContext = await storageContextFromDefaults({ persistDir: filePath })\n\n            try {\n                await VectorStoreIndex.fromDocuments(llamadocs, { serviceContext, storageContext })\n                return { numAdded: finalDocs.length, addedDocs: finalDocs }\n            } catch (e) {\n                throw new Error(e)\n            }\n        }\n    }\n\n    async init(nodeData: INodeData): Promise<any> {\n        const basePath = nodeData.inputs?.basePath as string\n        const embeddings = nodeData.inputs?.embeddings\n        const model = nodeData.inputs?.model\n        const topK = nodeData.inputs?.topK as string\n        const k = topK ? parseFloat(topK) : 4\n\n        // Validate and sanitize the base path to prevent path traversal attacks\n        const filePath = validateVectorStorePath(basePath)\n\n        const serviceContext = serviceContextFromDefaults({ llm: model, embedModel: embeddings })\n        const storageContext = await storageContextFromDefaults({ persistDir: filePath })\n\n        const index = await VectorStoreIndex.init({ storageContext, serviceContext })","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/SimpleStore/SimpleStore.ts#L93-L129","documentation":"SimpleStore's `add` path builds a LlamaIndex `VectorStoreIndex` from documents against a sanitized `basePath` and wraps any thrown value as `new Error(e)`. Failures come from LlamaIndex's `fromDocuments`/`storageContext` layer: persist directory permission errors, embedding/LLM model errors, or serialization failures. The re-wrap loses the original stack.","triggerScenarios":"`basePath` not writable or fails `validateVectorStorePath`; embedding/LLM model misconfigured in `serviceContext`; disk full / permission denied writing the persist dir; LlamaIndex version incompatibility raising during index build.","commonSituations":"Running as a user without write permission to basePath; relative basePath resolved against an unexpected cwd; model input missing or wrong type; persist dir locked by another process.","solutions":["Ensure `basePath` resolves to a writable, absolute directory and passes path validation.","Confirm the `embeddings` and `model` inputs are valid LlamaIndex model instances.","Free disk space and fix directory ownership/permissions on the persist dir.","Reproduce `VectorStoreIndex.fromDocuments` standalone to surface the original error."],"exampleFix":"// before\ncatch (e) { throw new Error(e) }\n\n// after\ncatch (e) { throw new Error(`SimpleStore indexing failed: ${e instanceof Error ? e.message : String(e)}`, { cause: e }) }","handlingStrategy":"try-catch","validationCode":"function validateSimpleStoreInputs(inputs: any) {\n  if (!inputs?.basePath) throw new Error('basePath is required')\n  if (!inputs?.embeddings) throw new Error('embeddings is required')\n  // validateVectorStorePath already guards traversal; ensure writability\n}","typeGuard":"null","tryCatchPattern":"try { await VectorStoreIndex.fromDocuments(llamadocs, { serviceContext, storageContext }) }\ncatch (e) { throw new Error(`SimpleStore index failed: ${e instanceof Error ? e.message : String(e)}`, { cause: e }) }","preventionTips":["Use an absolute, writable basePath.","Confirm embeddings/model are valid LlamaIndex instances.","Run the worker with write permission to the persist dir.","Reproduce fromDocuments standalone to surface the real error."],"tags":["llamaindex","simplestore","vectorstore","error-wrapping","filesystem","typescript"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}