FlowiseAI/Flowise · error · Error

${e}

Error message

${e}

What it means

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.

Source

Thrown at packages/components/nodes/vectorstores/InMemory/InMemoryVectorStore.ts:83

    //@ts-ignore
    vectorStoreMethods = {
        async upsert(nodeData: INodeData): Promise<Partial<IndexingResult>> {
            const docs = nodeData.inputs?.document as Document[]
            const embeddings = nodeData.inputs?.embeddings as Embeddings

            const flattenDocs = docs && docs.length ? flatten(docs) : []
            const finalDocs = []
            for (let i = 0; i < flattenDocs.length; i += 1) {
                if (flattenDocs[i] && flattenDocs[i].pageContent) {
                    finalDocs.push(new Document(flattenDocs[i]))
                }
            }

            try {
                await MemoryVectorStore.fromDocuments(finalDocs, embeddings)
                return { numAdded: finalDocs.length, addedDocs: finalDocs }
            } catch (e) {
                throw new Error(e)
            }
        }
    }

    async init(nodeData: INodeData): Promise<any> {
        const docs = nodeData.inputs?.document as Document[]
        const embeddings = nodeData.inputs?.embeddings as Embeddings
        const output = nodeData.outputs?.output as string
        const topK = nodeData.inputs?.topK as string
        const k = topK ? parseFloat(topK) : 4

        const flattenDocs = docs && docs.length ? flatten(docs) : []
        const finalDocs = []
        for (let i = 0; i < flattenDocs.length; i += 1) {
            if (flattenDocs[i] && flattenDocs[i].pageContent) {
                finalDocs.push(new Document(flattenDocs[i]))
            }
        }

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Verify the embeddings object and its API key/endpoint before upsert.
  2. Ensure finalDocs entries have non-empty pageContent.
  3. Rethrow `e` directly to preserve the embedding SDK error.

Example fix

// before
} catch (e) {
    throw new Error(e)
}

// after
} catch (e) {
    console.error('InMemoryVectorStore fromDocuments failed', e)
    throw e
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!embeddings || typeof embeddings.embedDocuments !== 'function') {
  throw new Error('embeddings object missing or invalid')
}
if (!finalDocs.every(d => d && typeof d.pageContent === 'string' && d.pageContent.length > 0)) {
  throw new Error('all documents must have non-empty pageContent')
}

Type guard

function isEmbeddings(v: unknown): v is { embedDocuments(t: string[]): Promise<number[][]> } {
  return typeof v === 'object' && v !== null && typeof (v as any).embedDocuments === 'function'
}

Try / catch

try {
  await MemoryVectorStore.fromDocuments(finalDocs, embeddings)
} catch (e) {
  throw new Error(`InMemory upsert failed (docs=${finalDocs.length}): ${e instanceof Error ? e.message : e}`)
}

Prevention

When it happens

Trigger: 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.

Common situations: Embedding provider (OpenAI, local model) unreachable or rate-limited, API key missing, or finalDocs containing malformed pageContent.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/5f8337837cea29aa. Report an issue: GitHub.