Jump to solution
Verify

The Fix

pip install celery==5.1.1

Based on closed celery/celery issue #6441 · PR/commit linked

Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.

Jump to Verify Open PR/Commit
@@ -6,9 +6,9 @@ from kombu.utils.uuid import uuid -from celery import current_app, group, states +from celery import current_app, states from celery._state import _task_stack
repro.py
import celery app = celery.Celery(broker="redis://", backend="redis://") @app.task def nop(*_): pass @app.task def die(*_): raise RuntimeError @app.task(bind=True) def replace(self, with_): with_ = celery.Signature.from_dict(with_) raise self.replace(with_) @app.task def cb(*args): print("CALLBACK", *args) #c = celery.chain(nop.s(), die.s()) c = celery.chain(nop.s(), replace.si(die.s())) c.link_error(cb.s()) c.apply_async()
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install celery==5.1.1\nWhen NOT to use: Do not use this fix if the task replacement logic is intentionally designed to drop callbacks.\n\n

Why This Fix Works in Production

  • Trigger: - [x] I have included all related issues and possible duplicate issues
  • Mechanism: The errbacks and callbacks of replaced tasks were not retained during task replacement
  • Why the fix works: This change fixes the handling of callbacks and errbacks on tasks which get replaced to ensure they get called as expected if the replacement signature succeeds or fails. (first fixed release: 5.1.1).

Why This Breaks in Prod

  • The errbacks and callbacks of replaced tasks were not retained during task replacement
  • Production symptom (often without a traceback): - [x] I have included all related issues and possible duplicate issues

Proof / Evidence

  • GitHub issue: #6441
  • Fix PR: https://github.com/celery/celery/pull/6770
  • First fixed release: 5.1.1
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.61

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“I've not been able to do anything about this one”
@maybe-sybr · 2021-02-20 · source

Failure Signature (Search String)

  • - [x] I have included all related issues and possible duplicate issues
  • or possible duplicates to this issue as requested by the checklist above.
Copy-friendly signature
signature.txt
Failure Signature ----------------- - [x] I have included all related issues and possible duplicate issues or possible duplicates to this issue as requested by the checklist above.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- - [x] I have included all related issues and possible duplicate issues or possible duplicates to this issue as requested by the checklist above.

Minimal Reproduction

repro.py
import celery app = celery.Celery(broker="redis://", backend="redis://") @app.task def nop(*_): pass @app.task def die(*_): raise RuntimeError @app.task(bind=True) def replace(self, with_): with_ = celery.Signature.from_dict(with_) raise self.replace(with_) @app.task def cb(*args): print("CALLBACK", *args) #c = celery.chain(nop.s(), die.s()) c = celery.chain(nop.s(), replace.si(die.s())) c.link_error(cb.s()) c.apply_async()

What Broke

Tasks failed to execute their errbacks, leading to unhandled errors in production.

Why It Broke

The errbacks and callbacks of replaced tasks were not retained during task replacement

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install celery==5.1.1

When NOT to use: Do not use this fix if the task replacement logic is intentionally designed to drop callbacks.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/celery/celery/pull/6770

First fixed release: 5.1.1

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if the task replacement logic is intentionally designed to drop callbacks.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
  • Pin production dependencies and upgrade only with a reproducible test that hits the failing path.

Version Compatibility Table

VersionStatus
5.1.1 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.