Module 02 · Workflow Architecture
Error Handling and Retry Logic in n8n
Open lesson + course map
On this lesson
Course outline
Module 1 · Why n8n, Why Now
Module 2 · Workflow Architecture
Module 3 · Working With APIs
Module 4 · Webhooks and Triggers
Module 5 · Self-Hosting n8n
Module 6 · AI Nodes in n8n
Module 7 · Real Business Automations
Module 8 · Selling Automation as a Service
Retry only failures known to be temporary and safe to repeat. n8n supports node retry behavior and error workflows, but the workflow designer must classify errors and protect side effects.
// concept
Define the Error Taxonomy
VALIDATION — bad/missing input; stop
AUTHENTICATION — expired/invalid identity; refresh through supported path or stop
AUTHORIZATION — forbidden; stop, never bypass
RATE_LIMIT — retry with provider guidance and cap
TEMPORARY — bounded backoff
CONFLICT — reconcile current state
TIMEOUT_UNKNOWN — query effect before retry
POLICY — stop and review
INTERNAL — alert with correlation IDReturn controlled codes, not raw secrets or stack traces to customers. Configure an error workflow to capture execution/workflow reference, safe error class, node, attempt, and owner.
// concept
Make Effects Idempotent
Before creating an order, message, invoice, or CRM record, establish a stable idempotency key from the triggering event and logical action. Store/check it in a durable authoritative service. n8n execution retry alone cannot guarantee external deduplication.
For TIMEOUT_UNKNOWN, query the provider using reference/idempotency key. Do not assume failure and repeat. Cap node attempts, workflow duration, and dead-letter age.
// worked_example
Worked Example
A courier booking call times out after submission. The workflow does not rerun create booking immediately. It calls get booking by client reference. If found, it stores the booking and continues; if confirmed absent and retryable, it retries using the same idempotency key.
An error workflow alerts Operations with execution_id, order_ref, class, attempt, and safe next step. The customer receives pending review, not a fabricated success.
// failure_cases
Failure Cases to Diagnose
6 cases to diagnose
Retry entire workflow
resume from a checkpoint/effect ledger.
New key on each attempt
keep logical identity stable.
403 treated as transient
stop and fix authorization.
Continue-on-error hides loss
route and account for failed items.
Error workflow itself fails silently
monitor and test it.
Execution data contains tokens
redact and restrict retention.
// pakistan_angle
Pakistan Angle
Wallets, banks, couriers, SMS, and government services may time out. Always reconcile through the provider’s official status mechanism before duplicating a payment, filing, dispatch, or customer message.
Use PKT in operator alerts where useful, UTC for durable timestamps, and a published after-hours path. Avoid infinite retries during regional connectivity or load-shedding events; they multiply foreign-currency API cost.
// hands_on
Hands-On Exercise
5 steps
Classify errors for every external node.
create an error workflow.
add stable idempotency to a sample write.
simulate 429, 403, timeout-after-effect, and invalid input.
prove replay creates one external record.
// completion_rubric
Completion Rubric
6 checks — tick as you verify
// sources
Sources
3 official sources — check every claim yourself
// check_yourself
Check yourself
4 questions · answers and options are taken word-for-word from this course
1 / 4 · diagnose
Your work shows this failure mode: “New key on each attempt.” What does the lesson tell you to do about it?