Email attachment save to NAS with AI check

Hello,

When a new email arrives, it should be checked if it has an attachment. If so, the email text should be checked with AI to see if it’s an invoice. If it is an invoice, the attachment should be saved on the network. The workflow only works when AI is not active. As soon as I activate the AI, it loses the binary attachment_0. I think that’s the problem, but I don’t know how to get the binary attachment_0 through the AI ​​(pass true).

What is the error message: Problem in node ‘Datei ins Netzwerk speichern‘

This operation expects the node’s input data to contain a binary file ‘attachment_0’, but none was found [item 0]

Please share your workflow

Share the output returned by the last node

Problem in node ‘Datei ins Netzwerk speichern‘
This operation expects the node’s input data to contain a binary file ‘attachment_0’, but none was found [item 0]

Information on your n8n setup

  • **n8n version:**1.122.5
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker):
  • Operating system:Docker / Synology

Hi @Wox, yes that is correct. The binary references fall away after data flows through some nodes, in your case the AI Agent. You will always need to make sure the binary is available in the node right be the one you need to use it, since it usually needs the name of the binary variable.

To fix your workflow, you can use a Merge node with the mode set to Combine by Position. This will cause the workflow to execute the AI Agent as well as copy over the binary.

See example below:

2 Likes

This operation expects the node’s input data to contain a binary file attachment_0, but none was found [item 0] .so use the Flow (logical): Email nodeAI nodeMerge nodeNetwork save node.........After your email node, branch the flow so you have the original email item available (do not overwrite).

  1. Send the email-text to the AI node (AI analyzes the text only).
  2. Feed the AI node output into the first input of a Merge node.
  3. Feed the original email node output (the one that still has binary.attachment_0) into the second input of the same Merge node.
  4. Configure the Merge node:
    • Mode: Merge By Index

    • (If you can guarantee 1:1 ordering, Merge By Index is easiest. If multiple items use Keep Key Matches with an appropriate key.)

  5. The Merge node output will contain both the AI result (JSON) and the binary.attachment_0 from the original email item.
  6. Point your “Datei ins Netzwerk speichern” node to the Merge node. Set its Binary Property to attachment_0
1 Like

Thank you All. The solution was the Merge node and the right settings with “Combine and Postion” I am very happy about, that works now :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.