Prompt
Why do my pipeline retries create duplicate events?
Latest observation
Nov 9, 2026
OpenAI APIWeb search: off
Pipeline retries usually create duplicate events because the retry re-runs work that is not fully idempotent. In other words, the first attempt may have already produced side effects before it failed, and the retry produces them again.
Common causes:
-
At-least-once delivery semantics
- Many pipelines, queues, and streaming systems retry on failure rather than guaranteeing exactly-once processing.
- This means the same event/message can be processed more than once.
-
Failure after side effect, before acknowledgment
- Example: your job writes an event to Kafka, S3, a database, or an API, then crashes before reporting success.
- The retry assumes the work didn’t happen and does it again.
-
Non-idempotent write operations
- If each retry creates a new row, new message, or new record without checking whether it already exists, duplicates are expected.
-
Partial commits in multi-step workflows
- If step 1 succeeds and step 2 fails, the retry may repeat step 1 unless you deduplicate or checkpoint progress.
-
Upstream retries plus downstream retries
- Multiple layers retrying can multiply duplicates, especially if each layer is unaware of the others.
How to prevent it:
- Make processing idempotent
- Use a unique event ID and ignore repeats.
- Use upserts / “insert if not exists” patterns.
- Add deduplication
- Store processed event IDs in a durable store.
- Use transactional outbox / inbox patterns
- Write the business change and event record atomically, then publish separately.
- Use checkpointing
- Track progress so retries resume instead of replaying completed work.
- Ensure idempotent external calls
- Many APIs support idempotency keys.
If you want, I can help you diagnose this for your specific pipeline if you share:
- the platform/tooling,
- where the retry happens,
- and what kind of duplicate event you’re seeing.