Celery with Redis: tasks run twice (visibility_timeout) Redis Origin: Data OSI layer 7 · Application Last updated 5 Nov 2026

Celery: Task executed twice / Restoring unacked messages — Redis broker visibility_timeout shorter than task ETA

Celery's Redis transport redelivers a task if it isn't acknowledged within visibility_timeout (1 hour by default).

Exact message you may see Celery tasks run twice Redis visibility_timeoutRestoring 1 unacknowledged message(s) Celery RedisCelery task executed twice with Redis brokervisibility_timeout Celery Redis ETA task duplicatedCelery duplicate task execution redis
Seen on: Redis Python

Meaning

Tasks with ETA/countdown or runtime longer than visibility_timeout get redelivered, so they run again. Set broker_transport_options = {"visibility_timeout": 43200} larger than the longest ETA/runtime, make tasks idempotent, and use acks_late consciously.

Common causes

  • ETA/countdown longer than visibility_timeout
  • Long-running tasks with acks_late=True
  • Worker restarts with unacked tasks
  • Short visibility_timeout configured
  • Multiple brokers/DBs mixing

⚡ Quick fix

  1. app.conf.broker_transport_options = {"visibility_timeout": 43200}
  2. Make tasks idempotent
  3. Avoid very long ETAs; use a scheduler (beat)

Detailed fix by platform

Python

  1. app.conf.broker_transport_options = {"visibility_timeout": 3600 * 12}

How to diagnose

  1. ETA — Longer than timeout?
  2. Runtime — Task duration?
  3. Idempotent — Safe to rerun?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

BullMQ: Missing lock for job / job stalled more than allowable limit — BullMQ: Error: Missing lock for job 42. moveToFinished / job stalled more than allowable limit (Redis)BullMQ: Missing lock …BUSY Redis is busy running a script — Redis: (error) BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE (Redis)BUSY Redis is busy ru…Client output buffer limit reached (scheduled to be closed) — Redis: Client id=12 addr=10.0.0.5:51234 scheduled to be closed ASAP for overcoming of output buffer limits (Redis)Client output buffer …ClientClosedError: The client is closed (node-redis v4) — node-redis: ClientClosedError: The client is closed (Redis)ClientClosedError: Th…CLUSTERDOWN Hash slot not served — Redis Cluster: (error) CLUSTERDOWN Hash slot not served / The cluster is down (Redis)CLUSTERDOWN Hash slot…CROSSSLOT Keys in request don't hash to the same slot — Redis Cluster: (error) CROSSSLOT Keys in request don't hash to the same slot (Redis)CROSSSLOT Keys in req…DENIED Redis is running in protected mode — Redis: DENIED Redis is running in protected mode because protected mode is enabled and no password is set for the default user (Redis)DENIED Redis is runni…ECONNRESET / Connection reset by peer on idle Redis connection — Redis: Error: read ECONNRESET / redis.exceptions.ConnectionError: Connection reset by peer after idle time (Redis)ECONNRESET / Connecti…Celery wi…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.