{"record":{"id":"bd64e2f66a0b1fce","repo":"n8n-io/n8n","slug":"single-document-per-item-expected","errorCode":null,"errorMessage":"Single document per item expected","messagePattern":"Single document per item expected","errorType":"validation","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-utilities/src/utils/vector-store/createVectorStoreNode/operations/updateOperation.ts","lineNumber":58,"sourceCode":"\t\t// Get the document ID to update\n\t\tconst documentId = context.getNodeParameter('id', itemIndex, '', {\n\t\t\textractValue: true,\n\t\t}) as string;\n\n\t\t// Get the vector store client\n\t\tconst vectorStore = await args.getVectorStoreClient(context, undefined, embeddings, itemIndex);\n\n\t\ttry {\n\t\t\t// Process the document from the input\n\t\t\tconst { processedDocuments, serializedDocuments } = await processDocument(\n\t\t\t\tloader,\n\t\t\t\titemData,\n\t\t\t\titemIndex,\n\t\t\t);\n\n\t\t\t// Validate that we have exactly one document to update\n\t\t\tif (processedDocuments?.length !== 1) {\n\t\t\t\tthrow new NodeOperationError(context.getNode(), 'Single document per item expected');\n\t\t\t}\n\n\t\t\t// Add the serialized document to the result\n\t\t\tresultData.push(...serializedDocuments);\n\n\t\t\t// Use document ID to update the existing document\n\t\t\tawait vectorStore.addDocuments(processedDocuments, {\n\t\t\t\tids: [documentId],\n\t\t\t});\n\n\t\t\t// Log the AI event for analytics\n\t\t\tlogAiEvent(context, 'ai-vector-store-updated');\n\t\t} finally {\n\t\t\t// Release the vector store client if a release method was provided\n\t\t\targs.releaseVectorStoreClient?.(vectorStore);\n\t\t}\n\t}\n","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-utilities/src/utils/vector-store/createVectorStoreNode/operations/updateOperation.ts#L40-L76","documentation":"Error \"Single document per item expected\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/ai-utilities/src/utils/vector-store/createVectorStoreNode/operations/updateOperation.ts:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}