FlowiseAI/Flowise · error · Error
${e}
Error message
${e} What it means
A generic catch-all in the MongoDB Atlas vector store node's `addDocuments` path: any exception thrown while constructing `MongoDBAtlasVectorSearch` or calling `addDocuments` is re-wrapped via `throw new Error(e)`. Because `new Error(e)` coerces a non-string to its string form, an original `Error` loses its stack trace and name, and the message becomes the original error's `.toString()` (e.g. `Error: connection timeout`).
Source
Thrown at packages/components/nodes/vectorstores/MongoDBAtlas/MongoDBAtlas.ts:159
finalDocs.push(document)
}
}
try {
if (!textKey || textKey === '') textKey = 'text'
if (!embeddingKey || embeddingKey === '') embeddingKey = 'embedding'
const mongoDBAtlasVectorSearch = new MongoDBAtlasVectorSearch(embeddings, {
connectionDetails: { mongoDBConnectUrl, databaseName, collectionName },
indexName,
textKey,
embeddingKey
})
await mongoDBAtlasVectorSearch.addDocuments(finalDocs)
return { numAdded: finalDocs.length, addedDocs: finalDocs }
} catch (e) {
throw new Error(e)
}
}
}
async init(nodeData: INodeData, _: string, options: ICommonObject): Promise<any> {
const credentialData = await getCredentialData(nodeData.credential ?? '', options)
const databaseName = nodeData.inputs?.databaseName as string
const collectionName = nodeData.inputs?.collectionName as string
const indexName = nodeData.inputs?.indexName as string
let textKey = nodeData.inputs?.textKey as string
let embeddingKey = nodeData.inputs?.embeddingKey as string
const embeddings = nodeData.inputs?.embeddings as Embeddings
const mongoMetadataFilter = nodeData.inputs?.mongoMetadataFilter as object
let mongoDBConnectUrl = getCredentialParam('mongoDBConnectUrl', credentialData, nodeData)
const mongoDbFilter: MongoDBAtlasVectorSearch['FilterType'] = {}
View on GitHub (pinned to abe4a8601a)
Solutions
- Read the wrapped message to get the MongoDB driver's underlying reason (auth, timeout, index).
- Verify the Atlas cluster's network access includes the current host IP.
- Confirm the vector search index exists and its `dimensions` match the embedding model output.
- Re-wrap with `Error`-preserving code (see fix) so future failures retain their stack.
- Rotate/re-check the `mongoDBConnectUrl` credential if auth is the cause.
Example fix
// before
} catch (e) {
throw new Error(e)
}
// after — preserve the original error chain
} catch (e) {
throw e instanceof Error ? e : new Error(String(e))
} Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: validate connection + index readiness
const client = new MongoClient(mongoDBConnectUrl)
await client.connect()
const coll = client.db(databaseName).collection(collectionName)
const indexes = await coll.listSearchIndexes({ name: indexName }).toArray()
if (!indexes.length || indexes[0].status !== 'READY') {
throw new Error(`Atlas search index '${indexName}' not ready`)
} Type guard
function isMongoError(e: unknown): e is { code: string; message: string } {
return typeof e === 'object' && e !== null && 'code' in e && 'message' in e
} Try / catch
try {
await mongoDBAtlasVectorSearch.addDocuments(finalDocs)
} catch (e) {
// preserve original error
throw e instanceof Error ? e : new Error(String(e))
} Prevention
- Add the host IP to the Atlas allow-list before connecting.
- Confirm the search index exists and is READY before writing.
- Keep the embedding dimension aligned with the index definition.
- Avoid `throw new Error(e)` — rethrow the original to preserve the stack.
When it happens
Trigger: MongoDB connection failure (bad URI, network blocked, IP not allow-listed on Atlas); the search index does not exist or is not ready; `addDocuments` violates a schema validation rule; embedding dimension does not match the vector field definition in the Atlas search index.
Common situations: Atlas cluster IP allow-list does not include the host; `mongoDBConnectUrl` credential stale or rotated; vector search index still building; embedding model changed without recreating the index definition.
Related errors
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/c0b988328026fc37.
Report an issue: GitHub.