Howwise RSS
AI & Automation8 min read

n8n Duplicate Webhook Executions: Diagnose and Stop Them

Short answer

n8n duplicate webhook executions almost always come from sender retries or a second active copy of the workflow. Respond with 200 immediately, derive an event ID key, and insert it atomically into a UNIQUE table before any side effect.

Key takeaways
  • Compare payloads and timestamps in Executions first: identical payloads mean sender retries, while two active copies or a double subscription means the cause is your own setup.
  • Respond to the webhook immediately, but still dedupe, because providers can deliver the same event twice by design.
  • Use the provider's event ID (Stripe evt_ id, X-Shopify-Event-Id, X-GitHub-Delivery, Slack event_id) as the idempotency key and never hash timestamps.
  • Insert the key first with a UNIQUE constraint (INSERT ... ON CONFLICT DO NOTHING or Redis SET NX EX) because select-then-insert has a race condition.
  • Return 200 for duplicates and make downstream actions idempotent with upserts and Idempotency-Key headers as a safety net.

Why do n8n duplicate webhook executions happen for one event?

There are three families of cause: the sender delivered the event more than once, a polling trigger saw the same record in two windows, or your own setup is running the workflow twice. The fix differs for each, so diagnose before changing anything.

Most webhook providers (Stripe, Shopify, GitHub, Typeform, Slack) use at-least-once delivery. If they do not get a 2xx fast enough, they resend. A workflow that does all its work and responds only at the end invites exactly this.

What you see in ExecutionsLikely causeGo to
Identical payload, different execution IDs, seconds or minutes apartSender retry after timeout or non-2xxRespond immediately, then dedupe
Same event ID in both payloadsAt-least-once delivery by designIdempotency key plus atomic insert
Payloads differ slightly but represent one change (for example created then updated)Sender emits several events per actionFilter on event type, key on ID plus type
Two executions at nearly the same millisecond, one marked testTest and production URL both listening, or workflow active in two instancesSelf-inflicted causes
Duplicates from Schedule, Gmail, Sheets, RSS or Airtable triggersOverlapping windows or reset statePolling triggers section

How do I tell which cause applies?

Open Executions, filter to the workflow, and open two duplicates side by side. Compare the trigger payload, the start time and the headers if you capture them.

  1. Identical payload and event ID, seconds or minutes apart: a sender retry. Check how long the first execution took, because a run longer than the sender's timeout explains it.
  2. Different execution IDs but the same event ID: at-least-once delivery. Retries will continue to happen even if you respond fast, so you need dedupe.
  3. Both executions start within milliseconds: look for two listeners. Check that the workflow is not active twice (a duplicate or imported copy with the same webhook path), and that the test URL is not open in the editor while the production URL is also registered at the sender.
  4. Check the sender's webhook settings for two subscriptions pointing at the same URL. This is common after re-creating an integration.
  5. Check the node setting Retry On Fail on downstream nodes. It re-runs that node, not the whole workflow, but it repeats side effects such as an email send that actually succeeded before timing out.
  6. If a reverse proxy or load balancer sits in front, look at its logs for 502 or 504 responses. Some proxies retry the request to another upstream, so n8n receives it twice.

Why do senders retry, and how fast must I respond?

Providers treat a slow response the same as a failure. The timeouts below are approximate and vary by provider, so aim to respond in well under a second regardless.

Respond first, work later. This removes timeout-driven retries, but not duplicates caused by design, which is why the rest of this page matters.

ProviderIdempotency keyApprox. response timeoutNotes
Stripeid of the event (evt_...)About 10s or moreRetries failed deliveries over days
ShopifyX-Shopify-Event-Id header5sIdentifies the event and stays the same when that event is redelivered; X-Shopify-Webhook-Id identifies the webhook subscription, so do not use it as the key
GitHubX-GitHub-Delivery headerAbout 10sRedelivery reuses the same delivery GUID
Slackevent_id in the bodyAbout 3sAlso sends X-Slack-Retry-Num header on retries
Typeformtoken or event_id in the payloadShort, treat as a few secondsUse the response token as the key
No ID availableSHA256 of stable fieldsn/aSee key section
Tip: Headers are not in the body. In the Webhook node, headers appear under $json.headers, with lowercase names such as x-shopify-event-id. Confirm header names against the provider's current webhook docs, since they can change.

How do I respond to the webhook immediately in n8n?

There are two options. In the Webhook node, set Respond to Immediately, which returns 200 as soon as the request is received. Or set it to Using Respond to Webhook Node and place that node first, directly after the trigger.

Use the second when you want to control the status code or body, for example when Slack URL verification needs the challenge echoed back.

Everything after the response still runs in the same execution. The caveat is that the sender can no longer see failures, so errors must be handled by an Error Workflow or your own alerts.

How do I stop n8n duplicate webhook executions with an idempotency key?

The pattern is: Webhook, Respond, compute key, insert key, IF new, do work. The key is written before any side effect, and the database decides who wins.

Build the key from the provider's event ID. If none exists, hash stable fields only, such as order ID plus event type. Never include timestamps or anything that changes between retries.

Why insert-first? A select then insert has a race: two retries arriving at the same moment both select, both find nothing, and both insert. A UNIQUE constraint makes the insert itself the check, so exactly one caller succeeds.

  1. Webhook node: HTTP Method POST, Respond set to Immediately.
  2. Code or Set node: compute event_key. Use the header or body ID, or a Crypto node SHA256 of stable fields.
  3. Postgres node (Execute Query): run the insert below with the key as a query parameter.
  4. IF node: continue only if a row was returned. Zero rows means duplicate.
  5. Duplicate branch: stop silently. Because you already responded 200, the sender is satisfied.
  6. New branch: do the real work.
CREATE TABLE IF NOT EXISTS processed_events (
  event_key  text PRIMARY KEY,
  created_at timestamptz NOT NULL DEFAULT now()
);

-- In the n8n Postgres node (Execute Query), with $1 = {{ $json.event_key }}
INSERT INTO processed_events (event_key)
VALUES ($1)
ON CONFLICT (event_key) DO NOTHING
RETURNING event_key;

-- Cleanup job (daily)
DELETE FROM processed_events WHERE created_at < now() - interval '30 days';
Warning: Record the key at the start, not the end. If you record it last, a crash causes reprocessing, and a retry arriving in the meantime runs twice. The trade-off: a crash after the insert loses that event, so pair it with an error alert or delete the key in an error branch.

Which dedupe option should I use?

The built-in Remove Duplicates node, with the operation Remove Items Processed in Previous Executions, keeps state across runs. Set Value to Dedupe On to your key expression, for example {{ $json.body.id }}, and choose the scope Workflow (or Node). A history size setting limits how many values are remembered, so size it above your expected event count in the retention window. It needs a recent n8n version. Older setups used workflow static data in a Code node, which only persists on active production runs, not manual tests.

For Redis, one command does the check and record: SET evt:<id> 1 NX EX 86400. It returns OK for a new key and nil for a duplicate, so branch on that. NX makes it atomic, and EX expires old keys by itself.

Data Tables, Google Sheets or Airtable lookups work for low volume, but are lookup-then-write and not atomic, so concurrent duplicates can slip through. Add a cleanup or TTL so the table does not grow forever.

ApproachAtomicBest forCaveat
Postgres or MySQL UNIQUE insertYesPayments, orders, anything with side effectsNeeds a database and cleanup job
Redis SET NX EXYesHigh volume, short windowsKeys vanish if Redis is not persistent
Remove Duplicates nodeMostly, not under parallel runsLow to medium volume, simple flowsHistory size limit, parallel executions can race
Data Tables, Sheets, AirtableNoLow volume, internal notificationsConcurrent duplicates slip through

How do I fix duplicates from polling triggers, self-inflicted causes and floods?

Polling triggers (Schedule, Gmail, Google Sheets, RSS, Airtable) duplicate because of overlapping windows, a since filter whose time is slightly off, or manual runs that reset state. Use the trigger's built-in new item state, store a last-processed cursor or record ID, and dedupe on the record ID, not a timestamp.

Self-inflicted causes include an imported copy active with the same webhook path, queue mode with webhook processors misconfigured, a proxy retrying on 502 or 504, and Retry On Fail repeating a non-idempotent node.

In a flood, parallel executions run the check at the same time. Limit concurrency with N8N_CONCURRENCY_PRODUCTION_LIMIT (or queue mode worker concurrency) so processing is serialized, and keep the dedupe write first in the workflow.

Finally, make the action idempotent. Use upserts (HubSpot, Airtable, SQL), a deterministic record ID, and an Idempotency-Key header for APIs like Stripe. This is the safety net when dedupe fails.

# Replay the same payload twice
for i in 1 2; do
  curl -s -o /dev/null -w "%{http_code}\n" -X POST \
    https://your-n8n.example.com/webhook/orders \
    -H 'Content-Type: application/json' \
    -H 'X-Shopify-Event-Id: test-123' \
    -d '{"order_id": 42, "type": "created"}'
done
Tip: Both calls should return 200. In Executions, the first should run the work branch and the second should end at the IF node with no side effects. Do not return 500 on a duplicate, because that makes the sender retry more.

Common questions

Does the test URL cause duplicate executions?

It can. If the editor is listening on the test URL and the sender is also registered for the production URL, one event can show up twice, once as a test run. Remove the test URL from the sender once you have captured a sample.

Is dedupe on a timestamp safe?

No. Timestamps often change between retries, so the key differs and the duplicate passes. Use the provider's event ID or a hash of fields that never change.

Should I return an error for a duplicate event?

No. Return 200 and skip the work. A 4xx or 5xx tells the sender the delivery failed, so it retries more.

How long should I keep idempotency keys?

Longer than the sender's maximum retry window. Stripe retries for days, so 7 to 30 days is a safe range, while a Redis TTL of 24 hours suits providers that retry within minutes.

Can Retry On Fail cause duplicate emails?

Yes. If a send node times out after the provider accepted the message, the retry sends it again. Prefer an idempotency key on the API call or disable retry for non-idempotent nodes.

Related topics:n8nwebhooksidempotencydeduplicationautomation