{"record":{"id":"b7b9458ef321011d","repo":"n8n-io/n8n","slug":"invalid-document-at-index-invalidindex","errorCode":null,"errorMessage":"Invalid document at index ${invalidIndex}","messagePattern":"Invalid document at index (.+?)","errorType":"validation","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/ai-utilities/src/utils/embeddings-input-validation.ts","lineNumber":44,"sourceCode":" *\n * @param documents - The documents array to validate\n * @param node - The node for error context\n * @returns The validated documents array\n * @throws NodeOperationError if documents is not an array or contains invalid entries\n */\nexport function validateEmbedDocumentsInput(documents: unknown, node: INode): string[] {\n\tif (!Array.isArray(documents)) {\n\t\tthrow new NodeOperationError(node, 'Documents must be an array', {\n\t\t\tdescription: 'Expected an array of strings to embed.',\n\t\t});\n\t}\n\n\tconst invalidIndex = documents.findIndex(\n\t\t(doc) => doc === undefined || doc === null || doc === '',\n\t);\n\n\tif (invalidIndex !== -1) {\n\t\tthrow new NodeOperationError(node, `Invalid document at index ${invalidIndex}`, {\n\t\t\tdescription: `Document at index ${invalidIndex} is empty or undefined. All documents must be non-empty strings.`,\n\t\t});\n\t}\n\n\treturn documents;\n}\n","sourceCodeStart":26,"sourceCodeEnd":51,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/ai-utilities/src/utils/embeddings-input-validation.ts#L26-L51","documentation":"Error \"Invalid document at index ${invalidIndex}\" thrown in n8n-io/n8n.","triggerScenarios":"Thrown at packages/@n8n/ai-utilities/src/utils/embeddings-input-validation.ts:44 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-12T18:17:37.767Z"}