n8n Remove Duplicates: stop processing the same item twice
How the n8n Remove Duplicates node works across executions, why a failed run can lose an event, and a tested data table pattern for duplicate-proof webhooks.

The Remove Duplicates node removes items you've already processed, either within one run or across runs. For webhooks and polling, set Operation to Remove Items Processed in Previous Executions, Keep Items Where to Value Is New, and Value to Dedupe On to a unique ID such as {{ $json.body.eventId }}. One catch: the node records an ID as soon as it sees it. If a later node fails, a retry of that event is dropped as a duplicate.
The short version:
- Within one run, Remove Items Repeated Within Current Input compares all fields, all but some, or selected fields.
- Across runs, Remove Items Processed in Previous Executions keeps a history of IDs (10,000 by default), or the highest number or latest date seen.
- A failed run still records the ID. In our test, an event whose workflow failed after Remove Duplicates was discarded when the sender retried it.
- If losing an event is worse than a rare duplicate, check a data table before the action and add the ID after it succeeds. Our tested workflow below does that.
- On 2.48.x, a full history stops the node. With History Size set to 3, every run after the third ID failed on n8n 2.48.5. On 2.49.0 the oldest IDs drop out instead.
We tested everything here on n8n 2.48.5, the current stable release, with a Webhook trigger and real HTTP requests, and repeated the history test on 2.49.0.
The three operations
From the Remove Duplicates docs:
| Operation | What it does | Use it for |
|---|---|---|
| Remove Items Repeated Within Current Input | Removes items that repeat inside the current input. Compare can be All Fields, All Fields Except or Selected Fields | Cleaning a list from one API call or file |
| Remove Items Processed in Previous Executions | Compares each item with what earlier runs saw and keeps only the new ones | Webhooks, polling triggers and schedules that fetch overlapping data |
| Clear Deduplication History | With Mode set to Clean Database, deletes the stored history | Starting over, for example after a test |
The node changed a lot in n8n 1.64.0, so tutorials older than that describe a different node.
Deduplicate across executions
Keep Items Where decides what "already seen" means:
- Value Is New keeps items whose Value to Dedupe On hasn't been seen before. Use a field that uniquely identifies the event or record: an event ID, an order number, a message ID.
- Value Is Higher than Any Previous Value keeps items whose value is higher than the highest seen so far. Use an increasing number, such as an auto-increment ID.
- Value Is a Date Later than Any Previous Date keeps items with a later date, in ISO format. Useful for "new since the last run" when you poll a list sorted by creation time.
Two options control the history:
- Scope: Node (the default) keeps a separate history for each Remove Duplicates node. Workflow shares one history between every Remove Duplicates node in the workflow that uses workflow scope.
- History Size: for Value Is New, how many IDs n8n remembers. The default is 10,000. When the history passes half that size, the node shows a hint (per its source) in the output pane that some duplicates may get through.
Pick the ID carefully. If the sender doesn't send a stable ID, build one from fields that identify the event, for example {{ $json.body.orderId }}-{{ $json.body.status }}. A timestamp of when the request arrived is never a good key, because a retry gets a new one.
The catch: a failed run still records the ID
Our test workflow was Webhook, then Remove Duplicates (Value Is New on {{ $json.body.eventId }}), then a Code node standing in for the real action, set to throw an error when the request had "fail": true. We sent these requests to the production webhook URL:
| Request | Result |
|---|---|
evt_1 | Processed |
evt_1 again | Discarded by Remove Duplicates, as intended |
evt_3 with "fail": true | Passed Remove Duplicates, then the action failed: execution status error |
evt_3 again, without the failure | Discarded. The action never ran for evt_3 |
That matches the node's source: it checks and records the IDs in one step, before the rest of the workflow runs. Nothing removes a single ID afterwards. Clear Deduplication History wipes the whole history for the node or workflow.
So Remove Duplicates is the right tool when a missed item is acceptable or easy to spot, like skipping RSS entries you've posted. When a webhook sender retries because your workflow failed, you want the retry to go through.
A duplicate-proof webhook that survives failures
Move the "mark as processed" step to the end, so an ID is only recorded once the action succeeded. A data table works well for this, because the Data table node can check for a row and insert one:
Webhook, If Row Does Not Exist, the action, then Insert into a processed_events data table
Nodes (4)
- Data Table ×2
- Code
- Webhook
Credentials you'll need
None
To import: copy the JSON, open a workflow in n8n and paste onto the canvas (Ctrl+V or ⌘V). Credentials are never included; connect your own after importing.
- Create a data table, for example
processed_events, with one string columneventId. - After the Webhook, add a Data table node with Operation If Row Does Not Exist: the condition is
eventIdequals{{ $json.body.eventId }}. Items that already have a row stop here. - Then your action (the Code node in our test).
- Last, a Data table node with Operation Insert that writes the
eventId.
The same sequence of requests on n8n 2.48.5:
evt_10was processed and recorded; a secondevt_10stopped at the check.evt_11with"fail": truefailed in the action, so nothing was recorded.- The retry of
evt_11went through, was processed and recorded, and a thirdevt_11stopped at the check.
The data table ended with exactly two rows, evt_10 and evt_11. You can download the workflow above and point it at your own table.
Two limits to know about. First, two copies of the same event arriving at the same moment can both pass the check before either inserts its row, so this pattern handles retries, not simultaneous duplicates. Second, if the action succeeds and the final insert fails, a retry runs the action again. When the action is an API call, pass the event ID as an idempotency key if the API supports one; n8n's own public API accepts an Idempotency-Key header on POSTs.
History size: what happens when it fills up
We set History Size to 3 and sent five different event IDs. On n8n 2.48.5, the first three were processed. Every run after that failed in Remove Duplicates with:
The number of items to be processed exceeds the maximum history size. Please increase the history size or reduce the number of items to be processed.New IDs, old IDs, it didn't matter: every request we sent after that failed the same way. n8n 2.49.0's changelog lists the fix: "Prevent node from getting stuck when reaching maximum history size."
On n8n 2.49.0 (we upgraded a copy of the same instance), runs succeeded again and the history behaved like a moving window of the last three IDs. One side effect: once an ID drops out of the window, the node treats it as new. In our test, h7 was discarded while it was among the last three IDs, then processed a second time after two newer IDs pushed it out.
So:
- Size the history for your volume. It should cover every ID that could plausibly come back. The default of 10,000 is fine for most webhooks; a busy polling workflow may need more.
- On 2.48.x, watch for the error above and raise History Size before the history fills up. Our n8n 2.49 roundup covers the release with the fix.
- In 2.49.0's source, a single run with more distinct IDs than History Size still fails with the same error.
Common errors and fixes
| Problem | Cause and fix |
|---|---|
| Every run fails with "exceeds the maximum history size" | On 2.48.x and earlier, the history is full. Raise History Size, clear the history, or upgrade to 2.49. |
| A retried webhook event never reaches the action | The first attempt failed after Remove Duplicates, which had already recorded the ID. Use the data table pattern above. |
| Duplicates get through anyway | The key isn't stable (it includes a timestamp or a changing field), the ID dropped out of the history window, or two nodes use Node scope when you meant to share one history. |
| The node shows "The dedupe key set in Value to Dedupe On has no value" | The expression resolves to nothing. Check the field path, for example $json.body.eventId for a Webhook trigger. |
Related guides
- n8n webhooks: test vs production URL, auth and responses covers the trigger itself.
- n8n error handling shows how to find and retry failed executions.
- n8n rate limits explains why Retry On Fail can send the same items twice.
Sources
Editorial team
The then8nblog editorial team researches every article from n8n's release notes, documentation and source code, states the n8n version each guide was tested on, and has every post reviewed by a human editor before it goes live.



