{"record":{"id":"03c405fbec3ce630","repo":"n8n-io/n8n","slug":"index-mongovectorindexname-not-found","errorCode":null,"errorMessage":"Index ${mongoVectorIndexName} not found","messagePattern":"Index (.+?) not found","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.ts","lineNumber":330,"sourceCode":"\tsharedFields,\n\tasync getVectorStoreClient(context, _filter, embeddings, itemIndex) {\n\t\tconst client = await createMongoClient(context, context.getNode().typeVersion);\n\t\ttry {\n\t\t\tconst db = await getDatabase(context, client);\n\t\t\tconst collectionName = getCollectionName(context, itemIndex);\n\t\t\tconst mongoVectorIndexName = getVectorIndexName(context, itemIndex);\n\t\t\tconst embeddingFieldName = getEmbeddingFieldName(context, itemIndex);\n\t\t\tconst metadataFieldName = getMetadataFieldName(context, itemIndex);\n\n\t\t\tconst collection = db.collection(collectionName);\n\n\t\t\t// test index exists\n\t\t\tconst indexes = await collection.listSearchIndexes().toArray();\n\n\t\t\tconst indexExists = indexes.some((index) => index.name === mongoVectorIndexName);\n\n\t\t\tif (!indexExists) {\n\t\t\t\tthrow new NodeOperationError(context.getNode(), `Index ${mongoVectorIndexName} not found`, {\n\t\t\t\t\titemIndex,\n\t\t\t\t\tdescription: 'Please check that the index exists in your collection',\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst preFilter = getFilterValue<IDataObject>(PRE_FILTER_NAME, context, itemIndex);\n\t\t\tconst postFilterPipeline = getFilterValue<IDataObject[]>(\n\t\t\t\tPOST_FILTER_NAME,\n\t\t\t\tcontext,\n\t\t\t\titemIndex,\n\t\t\t);\n\n\t\t\treturn new ExtendedMongoDBAtlasVectorSearch(\n\t\t\t\tembeddings,\n\t\t\t\t{\n\t\t\t\t\tcollection,\n\t\t\t\t\tindexName: mongoVectorIndexName, // Default index name\n\t\t\t\t\ttextKey: metadataFieldName, // Field containing raw text\n\t\t\t\t\tembeddingKey: embeddingFieldName, // Field containing embeddings","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreMongoDBAtlas/VectorStoreMongoDBAtlas.node.ts#L312-L348","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst indexExists = indexes.some((index) => index.name === mongoVectorIndexName);\nif (!indexExists) {\n  throw new NodeOperationError(context.getNode(), `Index ${mongoVectorIndexName} not found`, {\n    itemIndex,\n    description: 'Please check that the index exists in your collection',\n  });\n}\n\n// after: tell the user which indexes DO exist so they can pick the right one\nconst known = indexes.map((i) => i.name).filter(Boolean) as string[];\nif (!indexExists) {\n  throw new NodeOperationError(context.getNode(), `Index ${mongoVectorIndexName} not found`, {\n    itemIndex,\n    description: known.length\n      ? `Available indexes: ${known.join(', ')}. Create a 'vectorSearch' index named '${mongoVectorIndexName}' in Atlas if missing.`\n      : 'No search indexes exist on this collection. Create a vectorSearch index in Atlas.',\n  });\n}","handlingStrategy":"validation","validationCode":"// Pre-flight: confirm the index exists (and is ready) before the workflow runs.\nasync function ensureVectorIndex(collection: Collection, indexName: string): Promise<void> {\n  const indexes = await collection.listSearchIndexes().toArray();\n  const match = indexes.find((i) => i.name === indexName);\n  if (!match) throw new Error(`Index ${indexName} not found. Create a vectorSearch index in Atlas.`);\n  if (match.status && !/ready|active/i.test(String(match.status))) {\n    throw new Error(`Index ${indexName} is not ready (status: ${match.status}).`);\n  }\n}","typeGuard":"function hasNamedIndex(indexes: { name?: string }[], name: string): boolean {\n  return indexes.some((i) => i.name === name);\n}","tryCatchPattern":"const indexes = await collection.listSearchIndexes().toArray();\nif (!hasNamedIndex(indexes, mongoVectorIndexName)) {\n  throw new NodeOperationError(context.getNode(), `Index ${mongoVectorIndexName} not found`, {\n    itemIndex,\n    description: `Available: ${indexes.map((i) => i.name).filter(Boolean).join(', ') || 'none'}`,\n  });\n}","preventionTips":["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."],"tags":["mongodb-atlas","vector-store","missing-index","configuration","node-operation-error","langchain"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}