n8n Outlook attachment: item 2 read item 1’s binary field
n8n #44030 fixed the Microsoft Outlook Add attachment operation reading Input Data Field Name at index 0 for every item. It now uses the current item index.
The Add attachment operation read Input Data Field Name with item index 0 for every item. messageId and options used the current index, but the field name did not. With two items and an expression on the field name, item 2 read the field from item 1 and attached the wrong binary data.
This is one of the pull requests behind Six merged PRs in 72 hours. The series looks at the failure, the fix and the review evidence, one merge at a time.
The change: +37 / -1 across 2 files. PR 44030.
The bug
This is a subtle multi-item bug. A one-item test passes. A two-item test with different binary fields exposes the index leak. The user sees the right attachment count and the wrong attachment content, which is worse than a clear failure.
The fix reads the field name with the current index, like the other parameters.
Why it mattered
Binary attachments are high-consequence. Sending the wrong file to the wrong recipient is a data leak, not a formatting error. n8n’s item model makes it natural to process many items, so every parameter must use the same index.
The fix
Use the current item index for Input Data Field Name. The diff is one line of production code plus a regression test. No API change.
The evidence
The test has two input items: item 1 has binary data on data, item 2 on attachment. Input Data Field Name is an expression that returns data for item 1 and attachment for item 2. The new test fails on master and passes with the change. The PR runs the focused add.test.ts suite.
What I would repeat
Multi-item code has an implicit contract: every parameter for an item must use that item’s index. A one-item test cannot prove it. Add a second item with a different value and assert the side effect, not just the return value.
Sources
If this was useful, connect with me on LinkedIn; I write about the bugs behind merged pull requests and the evidence that gets them accepted.
FAQ
- What was the n8n Outlook bug?
- The Add attachment operation read Input Data Field Name from item 0 for every item, so item 2 could attach item 1’s binary data.
- What is the fix?
- Read the field name with the current item index, matching messageId and options.
- How was it tested?
- With two items that use different binary fields and an expression for Input Data Field Name.
Join the Newsletter
Subscribe to get my latest content by email.
We won't send you spam. Unsubscribe at any time.