AI agent node using send email Gmail tool with multiple attachments

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

Hi @shaslebacher

After analysis of your workflow - it looks like you are passing file path.

Looking into documentation (Gmail node Message Operations documentation | n8n Docs):

Attachments: Select Add Attachment to add an attachment. Enter the Attachment Field Name (in Input) to identify which field from the input node contains the attachment.

  • For multiple properties, enter a comma-separated list.

it should be:
attachment_0, attachment_1

and shouldn’t be:
={{ $someVariable.property.data}}