Node mechanics

n8n Binary Data: How to Attach a PDF to an Email Without the Mystery Error

2026-10-05 · 8 min read

Every n8n beginner hits the same wall: the PDF downloads fine, the email node says it cannot find it. Here is what binary data actually is, why attachments silently vanish, and the four settings that fix it.

The Error That Sends Everyone to Google

You build the obvious workflow: a form trigger receives a PDF, a node converts it, then a Gmail node sends it to the customer. It fails with a message that reads like a bug report from someone else:

The item has no binary field 'data' (item 0)

Nothing is wrong with your logic. The problem is that you are mixing up two completely separate data channels that n8n carries in parallel, and almost every beginner assumes only one of them exists.

Two Channels: JSON and Binary

Every item flowing between n8n nodes has two halves. The JSON half holds structured, inspectable values — strings, numbers, objects, arrays. This is what you see in the JSON tab of the output panel, what expressions like {{ $json.email }} read from, and what almost every node parameter expects by default.

The binary half holds raw file bytes — PDFs, images, spreadsheets, audio. This is what lives in the separate Binary tab of the output panel. Files are too large and too opaque to be JSON values, so n8n keeps them out of the text stream entirely.

That is the whole model, and it explains every symptom:

Fix 1: Match the Binary Property Name Exactly

This is the correct fix for roughly 80% of attachment failures, and it takes 30 seconds. Run the node that produces the file on its own, open the output panel, click the Binary tab, and copy the exact key name shown next to the file.

Then open your email node and set its attachment field to that exact string:

Run the producing node alone, read the Binary tab, and you never have to guess a property name again. The names in the community forum posts that leave you stuck (Bericht, image1868) are real, and they are always discoverable the same way.

Fix 2: Stop Your Code Nodes From Dropping Files

The second most common cause is a Code node in the middle of the chain. If your code builds a brand-new object and returns only json, the binary payload is gone from that point onward — and the email node fails with the exact same "no binary field" message even though the name is right.

Preserve both halves explicitly in the Run Once for All Items mode:

// ❌ drops the file — binary is gone from here on
return items.map(i => ({ json: { email: i.json.email } }));

// ✅ carries json and binary through
return items.map(i => ({
  json: { email: i.json.email },
  binary: i.binary
}));

Same rule for the Set and Aggregate nodes: set "Keep Only Set Fields" to off so existing binary data is retained. An Aggregate node set to All Item Data but with Include Binaries unchecked is a very common source of a one-line fix.

Fix 3: Convert the File to the Format You Actually Attach

Attaching a converted file needs two nodes, in the right order:

  1. Convert to File — takes a text/binary/JSON value and wraps it as a real file. It needs a Binary Property name and a File Name, e.g. data and invoice.pdf.
  2. Edit Fields (Set) or your email node — reference that same property name.

A very common source of confusion is Extract from File. That node reads a file's contents into JSON — useful for reading a CSV or invoice PDF, and the opposite of attaching. Use it when you need to parse, and convert to file when you need to send. Running the wrong one of the pair is why the attachment "disappears" and turns up as an unreadable blob of text instead.

Fix 4: Binary Storage Mode Matters on Self-Hosted n8n

Where n8n keeps those bytes is a server-level decision, and it changes how reliable attachments are — especially if you self-host, which most of this site's readers do.

The backup consequence nobody warns you about

If you switch binary modes, n8n only prunes the mode that is currently active — and your existing backup of the database will not contain the files that live on disk in filesystem mode. If you built a workflow that attaches PDFs, add binaryData/ to the same backup job that dumps your database, or a restore will bring back every workflow with the attachments missing.

Pruning also runs against the active mode only, so leftover files from a previous mode can sit on disk indefinitely. Worth a du -sh ~/.n8n/binaryData on a self-hosted box every few weeks.

A Checklist That Prevents 95% of This Class of Bug

Related Reading

Binary data is where the abstractions leak. The same pairing — a trigger handing off to a downstream action — shows up in setting up n8n error handling so a failed attachment never fails silently, and in idempotency on webhooks, where the same retry that duplicates a charge also duplicates the attached invoice. Get the error path right first and the binary field name is the only thing left to get right.

Want the workflow, not the write-up?

Every Matemplates workflow imports into your own n8n instance — you own it, run it free, and edit it. Grab one and ship today.

Browse the store →