{"record":{"id":"5f8337837cea29aa","repo":"FlowiseAI/Flowise","slug":"e-5f8337","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/vectorstores/InMemory/InMemoryVectorStore.ts","lineNumber":83,"sourceCode":"    //@ts-ignore\n    vectorStoreMethods = {\n        async upsert(nodeData: INodeData): Promise<Partial<IndexingResult>> {\n            const docs = nodeData.inputs?.document as Document[]\n            const embeddings = nodeData.inputs?.embeddings as Embeddings\n\n            const flattenDocs = docs && docs.length ? flatten(docs) : []\n            const finalDocs = []\n            for (let i = 0; i < flattenDocs.length; i += 1) {\n                if (flattenDocs[i] && flattenDocs[i].pageContent) {\n                    finalDocs.push(new Document(flattenDocs[i]))\n                }\n            }\n\n            try {\n                await MemoryVectorStore.fromDocuments(finalDocs, embeddings)\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 docs = nodeData.inputs?.document as Document[]\n        const embeddings = nodeData.inputs?.embeddings as Embeddings\n        const output = nodeData.outputs?.output as string\n        const topK = nodeData.inputs?.topK as string\n        const k = topK ? parseFloat(topK) : 4\n\n        const flattenDocs = docs && docs.length ? flatten(docs) : []\n        const finalDocs = []\n        for (let i = 0; i < flattenDocs.length; i += 1) {\n            if (flattenDocs[i] && flattenDocs[i].pageContent) {\n                finalDocs.push(new Document(flattenDocs[i]))\n            }\n        }","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/vectorstores/InMemory/InMemoryVectorStore.ts#L65-L101","documentation":"Generic catch-all in the InMemoryVectorStore upsert path around MemoryVectorStore.fromDocuments(finalDocs, embeddings). Wraps embedding computation failures or fromDocuments internal errors into a string Error.","triggerScenarios":"Upsert flattened, filtered documents into an in-memory store. Fails when embedDocuments rejects (model/transport error), or when the documents array contains items MemoryVectorStore cannot process.","commonSituations":"Embedding provider (OpenAI, local model) unreachable or rate-limited, API key missing, or finalDocs containing malformed pageContent.","solutions":["Verify the embeddings object and its API key/endpoint before upsert.","Ensure finalDocs entries have non-empty pageContent.","Rethrow `e` directly to preserve the embedding SDK error."],"exampleFix":"// before\n} catch (e) {\n    throw new Error(e)\n}\n\n// after\n} catch (e) {\n    console.error('InMemoryVectorStore fromDocuments failed', e)\n    throw e\n}","handlingStrategy":"try-catch","validationCode":"if (!embeddings || typeof embeddings.embedDocuments !== 'function') {\n  throw new Error('embeddings object missing or invalid')\n}\nif (!finalDocs.every(d => d && typeof d.pageContent === 'string' && d.pageContent.length > 0)) {\n  throw new Error('all documents must have non-empty pageContent')\n}","typeGuard":"function isEmbeddings(v: unknown): v is { embedDocuments(t: string[]): Promise<number[][]> } {\n  return typeof v === 'object' && v !== null && typeof (v as any).embedDocuments === 'function'\n}","tryCatchPattern":"try {\n  await MemoryVectorStore.fromDocuments(finalDocs, embeddings)\n} catch (e) {\n  throw new Error(`InMemory upsert failed (docs=${finalDocs.length}): ${e instanceof Error ? e.message : e}`)\n}","preventionTips":["Validate the embeddings object and API key before upsert.","Filter empty/invalid documents before embedding.","Note: in-memory store is lost on process restart — only for ephemeral use."],"tags":["in-memory","vector-store","error-wrapping","embeddings"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}