Prompt
unhappy with Google Cloud Pub/Sub duplicate deliveries
Latest observation
Oct 24, 2026
OpenAI APIWeb search: off
Google Cloud Pub/Sub can deliver duplicates, and that’s expected behavior. It provides at-least-once delivery, not exactly-once by default. So if you’re seeing the same message more than once, the system is behaving within spec.
Why duplicates happen
Common causes include:
- Ack deadline expired before the subscriber acknowledged the message
- Subscriber crashed / retried after processing but before acking
- Transient network issues
- Redelivery after a lease extension failure
- Publisher retries can also create duplicate publishes if you don’t dedupe on the producer side
What to do about it
You generally need to make your processing idempotent:
- Use a unique message ID or business key
- Store processed IDs in a database/cache
- Ignore messages you’ve already handled
- Make side effects safe to repeat
If you want to reduce duplicates
- Ack as soon as it’s safe
- Extend ack deadlines for longer processing
- Use exactly-once delivery if available for your subscription type and your use case supports it
- Tune subscriber concurrency and retry behavior
Important note
Even with exactly-once features, your application still often needs idempotent writes, because downstream systems may still see retries or partial failures.
If you want, I can help you with one of these:
- diagnosing why duplicates are happening in your setup,
- designing idempotent processing for Pub/Sub, or
- setting up Pub/Sub exactly-once delivery.
Brands