FlowiseAI/Flowise · error · Error

${e}

Error message

${e}

What it means

Generic catch-all wrapping `OpenSearchVectorStore.fromDocuments` in the OpenSearch node's add path. Any failure (client construction, index creation, bulk indexing, auth) is re-thrown as `new Error(e)`, losing the original stack and collapsing the error into its string form.

Solutions

  1. Read the flattened message for the OpenSearch client error (auth, connection, mapping).
  2. Verify the OpenSearch URL is reachable and the protocol/port are correct.
  3. Confirm auth method matches the cluster requirement (basic / API key / SigV4).
  4. Ensure the k-NN plugin is enabled and the index mapping's vector dimension matches the embedding output.
  5. Re-wrap preserving the original error (see fix).

Example fix

// before
} catch (e) {
    throw new Error(e)
}
// after — preserve cause
} catch (e) {
    throw e instanceof Error ? e : new Error(String(e))
}
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: parse URL and ping
const u = new URL(openSearchUrl)
if (!['http:', 'https:'].includes(u.protocol)) throw new Error('OpenSearch URL must be http(s)')
const ping = await fetch(`${u.origin}/_cluster/health`, { method: 'GET' })
if (!ping.ok) throw new Error(`OpenSearch unreachable: ${ping.status}`)

Type guard

function isOpenSearchUrl(v: string): boolean {
  try { const u = new URL(v); return ['http:', 'https:'].includes(u.protocol) } catch { return false }
}

Try / catch

try {
  await OpenSearchVectorStore.fromDocuments(finalDocs, embeddings, { client, indexName })
} catch (e) {
  throw e instanceof Error ? e : new Error(`OpenSearch fromDocuments failed: ${String(e)}`)
}

Prevention

When it happens

Trigger: OpenSearch endpoint unreachable; wrong protocol/port in the URL; auth (basic/API key/AWS SigV4) misconfigured; vector dimension mismatch with the k-NN index mapping; bulk indexing rejected due to mapping conflicts.

Common situations: Self-hosted OpenSearch behind a different port than configured; AWS OpenSearch requiring SigV4 but only basic auth supplied; k-NN plugin not installed; embedding model changed dimension without re-creating the index mapping.

Related errors


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

Appendix: source

Thrown at packages/components/nodes/vectorstores/OpenSearch/OpenSearch.ts:137

            const client = getOpenSearchClient(opensearchURL, user, password)

            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 OpenSearchVectorStore.fromDocuments(finalDocs, embeddings, {
                    client,
                    indexName: indexName,
                    vectorSearchOptions: getVectorSearchOptions(nodeData)
                })
                return { numAdded: finalDocs.length, addedDocs: finalDocs }
            } catch (e) {
                throw new Error(e)
            }
        }
    }

    async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
        const embeddings = nodeData.inputs?.embeddings as Embeddings
        const indexName = nodeData.inputs?.indexName as string
        const output = nodeData.outputs?.output as string
        const topK = nodeData.inputs?.topK as string
        const k = topK ? parseFloat(topK) : 4
        const credentialData = await getCredentialData(nodeData.credential ?? '', options)
        const opensearchURL = getCredentialParam('openSearchUrl', credentialData, nodeData)
        const user = getCredentialParam('user', credentialData, nodeData)
        const password = getCredentialParam('password', credentialData, nodeData)

        const client = getOpenSearchClient(opensearchURL, user, password)

        const vectorStore = new OpenSearchVectorStore(embeddings, {

View on GitHub (pinned to abe4a8601a)