I am building a workflow that automatically fetches attachments from Gmail, extract the PDF’s data, has an AI agent that identifies invoices and forwards any document that is identified as an invoice to another email address. Some emails have multiple attachments including multiple invoices. In this case I want thee AI agent to send an email that includes all attachments it classified as invoices from an original email and omit any that were not classified as invoices.
I am getting an error message “Cannot read properties of undefined (reading ‘0’) (item 0)” in the Gmail tool of the AI agent. I have configured the email node to have subject, message and attachments defined by the model so would expect the model to be able to set the correct inputs.
Please share your workflow
Share the output returned by the last node
the AI agent is correctly identifying invoices but unable to send the email. This is the input from the AI agent in the send email tool
Subject
[forward] (same as original email)
Message
The attached PDF document represents an INVOICE based on the following evidence:
- It includes the term 'Rechnungsnummer' (Invoice number) and a specific invoice number (2025027405).
- There are clear supplier (Dipl.-Kfm. Alexander-A. Baé, Steuerberater) and recipient details (SH90 Invest UG, Wolliner Str. 19, 10435 Berlin).
- It contains line items for services rendered, including amounts, VAT, and a total amount due.
- Bank details for payment are provided.
- 'Rechnungsdatum' (invoice date) is specified.
Therefore, this document is classified a... attachmentsBinary0_Attachment_Field_Name invoice_pdf_attachment
Information on your n8n setup
- n8n version: 1.107.4
- Database (default: SQLite): SQLite
- n8n EXECUTIONS_PROCESS setting (default: own, main): own, main
- Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
- Operating system: windows
