Skip to main content

ETL Pipeline Error Handling Framework

Design a robust error handling framework for ETL pipelines with dead letter queues, retry strategies, data quarantine, and alerting.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt
Design an error handling framework for batch and micro-batch ETL pipelines processing 50 million events across 12 source tables daily. The pipeline uses Python, Apache Airflow, Snowflake, AWS S3. Build: 1) A classification system for errors — transient (network timeouts, API rate limits) vs permanent (schema mismatch, invalid data) vs partial (some rows fail, others succeed) — with appropriate handling strategy for each class. 2) A retry mechanism with exponential backoff for transient errors: initial delay 5 seconds, max retries 5, with circuit breaker that opens after 10 consecutive failures and resets after 15 minutes. 3) A dead letter queue (DLQ) in S3 bucket with Parquet format where failed records are stored with error context (original payload, error message, timestamp, retry count, pipeline stage). 4) Data quarantine tables that capture rows failing validation with reason codes, enabling analysts to investigate and fix without blocking the pipeline. 5) Alerting tiers: INFO for retries, WARNING for DLQ entries exceeding 1000 records, CRITICAL for circuit breaker open or pipeline halt, sent to Slack #data-oncall and PagerDuty for critical. 6) A recovery workflow: script to replay DLQ records after fixing the root cause, with idempotency guarantees. 7) Observability: metrics for error rates, retry counts, DLQ depth, and processing latency exported to Datadog.

What this prompt does

This prompt makes the AI design an error-handling framework for ETL pipelines, treating failure as the normal case rather than an afterthought. You specify [pipeline_type], the [data_volume] processed daily, and the [tech_stack], and the model builds a classification system that separates transient errors (timeouts, rate limits) from permanent ones (schema mismatch, invalid data) and partial failures, each with its own handling strategy.

The structure works because it forces the unhappy paths to be designed before the happy path. It specifies a retry mechanism with exponential backoff ([initial_delay], [max_retries]) and a circuit breaker that opens after [circuit_threshold] failures and resets after [circuit_reset] minutes, a dead letter queue in [dlq_storage] with full error context, quarantine tables with reason codes, tiered alerting to [alert_channels] keyed off [dlq_threshold], a replay/recovery workflow with idempotency, and observability metrics to [monitoring_tool]. Classifying transient versus permanent up front is what stops a pipeline from retrying itself into an outage.

When to use it

  • You're building a batch pipeline that will inevitably hit bad data and want resilient paths designed in.
  • You need to stop retrying permanent errors while still backing off on transient ones.
  • You want failed records captured in a DLQ with enough context to debug, not silently dropped.
  • You need a quarantine path so a few bad rows don't block the whole load.
  • You want tiered alerting that distinguishes a routine retry from a circuit-breaker-open emergency.
  • You need a tested replay workflow to reprocess DLQ records after fixing the root cause.

Example output

Expect a framework design: an error taxonomy with handling rules per class, retry-with-backoff and circuit-breaker logic with your thresholds, a DLQ schema in [dlq_storage] capturing payload, error message, timestamp, retry count, and stage, quarantine table definitions with reason codes, an alerting tier table (INFO/WARNING/CRITICAL) mapped to [alert_channels], an idempotent replay script, and the metrics exported to [monitoring_tool].

Pro tips

  • Get the transient-versus-permanent split right — retrying a schema mismatch wastes cycles and can amplify an outage, while not retrying a timeout drops recoverable data.
  • Tune [circuit_threshold] and [circuit_reset] so the breaker trips before a failing dependency causes a retry storm, but not so eagerly that one blip halts the pipeline.
  • Capture full context in the [dlq_storage] records (original payload, stage, retry count); a DLQ without the payload is hard to replay.
  • Make the replay workflow genuinely idempotent — reprocessing DLQ records must not double-load rows that partially succeeded the first time.
  • Set [dlq_threshold] based on normal noise; alerting on a single DLQ entry will train the team to ignore the alerts.
  • Wire the metrics (error rate, retry count, DLQ depth, latency) to [monitoring_tool] early so you can see a slow degradation before it becomes a halt.

Frequently Asked Questions

Why classify errors as transient, permanent, or partial?
Each class needs a different response: transient errors like timeouts should be retried with backoff, permanent errors like schema mismatches should not, and partial failures route bad rows aside while good ones proceed. Classifying up front is what stops a pipeline from retrying a permanent error into an outage.
What is the dead letter queue used for here?
Failed records are written to a DLQ with full context — original payload, error message, timestamp, retry count, and pipeline stage. That context is what makes the replay workflow possible, so you can fix the root cause and reprocess the failed records without re-running the whole pipeline.
Does the circuit breaker prevent retry storms?
Yes, the breaker opens after a configured number of consecutive failures and resets after a set number of minutes. This stops the retry-with-backoff loop from hammering a failing dependency, but you should tune the threshold so a single transient blip doesn't trip it unnecessarily.
Is the replay process safe to run more than once?
The prompt specifies idempotency guarantees for the recovery workflow, so replaying DLQ records shouldn't double-load rows that already succeeded. You still need to verify idempotency against your specific load logic, since correctness depends on how your final upsert or merge is written.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in Data Engineering & ETL Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

AI assistant · trained on my work

👋

Hey there!

Quick Actions

WhatsApp Direct line to me

Chat on WhatsApp

+880 1723 741224 · Replies within the hour on working days

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

mejba.13@gmail.com

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support