n8n-io/n8n · error · NodeOperationError
Index ${mongoVectorIndexName} not found
Error message
Index ${mongoVectorIndexName} not found What it means
NodeOperationError (with remediation description) thrown when building the Atlas vector store client: the node lists search indexes on the collection and the user-supplied vector index name is not among them. MongoDB Atlas Vector Search requires a pre-created `vectorSearch` index before queries can run.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.ts:330
sharedFields,
async getVectorStoreClient(context, _filter, embeddings, itemIndex) {
const client = await createMongoClient(context, context.getNode().typeVersion);
try {
const db = await getDatabase(context, client);
const collectionName = getCollectionName(context, itemIndex);
const mongoVectorIndexName = getVectorIndexName(context, itemIndex);
const embeddingFieldName = getEmbeddingFieldName(context, itemIndex);
const metadataFieldName = getMetadataFieldName(context, itemIndex);
const collection = db.collection(collectionName);
// test index exists
const indexes = await collection.listSearchIndexes().toArray();
const indexExists = indexes.some((index) => index.name === mongoVectorIndexName);
if (!indexExists) {
throw new NodeOperationError(context.getNode(), `Index ${mongoVectorIndexName} not found`, {
itemIndex,
description: 'Please check that the index exists in your collection',
});
}
const preFilter = getFilterValue<IDataObject>(PRE_FILTER_NAME, context, itemIndex);
const postFilterPipeline = getFilterValue<IDataObject[]>(
POST_FILTER_NAME,
context,
itemIndex,
);
return new ExtendedMongoDBAtlasVectorSearch(
embeddings,
{
collection,
indexName: mongoVectorIndexName, // Default index name
textKey: metadataFieldName, // Field containing raw text
embeddingKey: embeddingFieldName, // Field containing embeddingsView on GitHub (pinned to 5ac6606e81)
Solutions
- In the Atlas UI, create a Search Index of type `vectorSearch` on the target collection with the configured name.
- Match the node's `vectorIndexName` field exactly to the index name shown in Atlas.
- Wait for the index to finish building (status `ACTIVE`) before running the node.
- Confirm the right database and collection are selected so the index lookup hits the right place.
Example fix
// before
const indexExists = indexes.some((index) => index.name === mongoVectorIndexName);
if (!indexExists) {
throw new NodeOperationError(context.getNode(), `Index ${mongoVectorIndexName} not found`, {
itemIndex,
description: 'Please check that the index exists in your collection',
});
}
// after: tell the user which indexes DO exist so they can pick the right one
const known = indexes.map((i) => i.name).filter(Boolean) as string[];
if (!indexExists) {
throw new NodeOperationError(context.getNode(), `Index ${mongoVectorIndexName} not found`, {
itemIndex,
description: known.length
? `Available indexes: ${known.join(', ')}. Create a 'vectorSearch' index named '${mongoVectorIndexName}' in Atlas if missing.`
: 'No search indexes exist on this collection. Create a vectorSearch index in Atlas.',
});
} Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight: confirm the index exists (and is ready) before the workflow runs.
async function ensureVectorIndex(collection: Collection, indexName: string): Promise<void> {
const indexes = await collection.listSearchIndexes().toArray();
const match = indexes.find((i) => i.name === indexName);
if (!match) throw new Error(`Index ${indexName} not found. Create a vectorSearch index in Atlas.`);
if (match.status && !/ready|active/i.test(String(match.status))) {
throw new Error(`Index ${indexName} is not ready (status: ${match.status}).`);
}
} Type guard
function hasNamedIndex(indexes: { name?: string }[], name: string): boolean {
return indexes.some((i) => i.name === name);
} Try / catch
const indexes = await collection.listSearchIndexes().toArray();
if (!hasNamedIndex(indexes, mongoVectorIndexName)) {
throw new NodeOperationError(context.getNode(), `Index ${mongoVectorIndexName} not found`, {
itemIndex,
description: `Available: ${indexes.map((i) => i.name).filter(Boolean).join(', ') || 'none'}`,
});
} Prevention
- Create the vectorSearch index in Atlas before running Retrieve/Load mode.
- Match the index name exactly (case-sensitive).
- Wait for index status ACTIVE before querying.
When it happens
Trigger: Running the node in Retrieve / Load mode before the vector index has been created in the Atlas UI; the index was created with a different name than what is configured in the node; the index is still building (`status: 'BUILDING'`) and not yet listed as active.
Common situations: New Atlas cluster where the user created the collection but forgot the search index; index named `default` but the node expects `vector_index`; index recently deleted; wrong database/collection selected so the lookup runs against an empty collection.
Related errors
- Index ${index} not found
- Error: ${error.message}
- Parameter ${key} must be a string
- Error: No JSON string provided.
- Redis client not initialized
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/03c405fbec3ce630.
Report an issue: GitHub.