Jump to solution
Verify

The Fix

pip install celery==5.3.0a1

Based on closed celery/celery issue #7523 · 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
@@ -286,4 +286,5 @@ Patrick Zhang, 2017/08/19 kronion, 2021/08/26 Gabor Boros, 2021/11/09 -Tizian Seehaus, 2022/02/09 \ No newline at end of file +Tizian Seehaus, 2022/02/09
repro.py
from functools import partial from typing import Final from celery import Task, Celery BASE_CELERY_BROKER_URL = "amqp://user:pass@localhost:5672" CELERY_RESULT_URL = "redis://localhost:6379/0" def make_celery_worker_app_stub() -> partial[Celery]: return partial( Celery, task_create_missing_queues=True, task_acks_late=True, result_extended=True, result_expires=3600, worker_send_task_events=True, ) app: Final = make_celery_worker_app_stub()( main=__name__, result_backend=CELERY_RESULT_URL, broker="%s" % (BASE_CELERY_BROKER_URL), set_as_current=False, ) @app.task( bind=True, queue="my_queue", name="my_name:my_function", acks_late=True, task_reject_on_worker_lost=True, autoretry_for=(Exception,), retry_backoff=True, max_retries=3, task_time_limit=8, ) def failing_function( self: Task, data ) -> None: print(data) # prints hello print(self.request.properties["application_headers"]) assert False == True
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.3.0a1\nWhen NOT to use: Do not use this fix if custom headers are required to be separated from internal properties.\n\n

Why This Fix Works in Production

  • Trigger: - [x] I have included all related issues and possible duplicate issues
  • Mechanism: Custom headers were not initialized during task retries, causing loss of header information
  • Why the fix works: Fixes the issue of custom headers being lost during task retries by implementing a method to filter unknown dictionary keys as custom headers. (first fixed release: 5.3.0a1).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • Triggered by an upgrade/regression window: 48.433839–49.447913 breaks; 5.3.0a1 is the first fixed release.
  • Custom headers were not initialized during task retries, causing loss of header information
  • Production symptom (often without a traceback): - [x] I have included all related issues and possible duplicate issues

Proof / Evidence

  • GitHub issue: #7523
  • Fix PR: https://github.com/celery/celery/pull/7555
  • First fixed release: 5.3.0a1
  • Affected versions: 48.433839–49.447913
  • 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.48

Discussion

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

“Hey @Leem0sh :wave:, Thank you for opening an issue”
@open-collective-bot · 2022-05-12 · 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
from functools import partial from typing import Final from celery import Task, Celery BASE_CELERY_BROKER_URL = "amqp://user:pass@localhost:5672" CELERY_RESULT_URL = "redis://localhost:6379/0" def make_celery_worker_app_stub() -> partial[Celery]: return partial( Celery, task_create_missing_queues=True, task_acks_late=True, result_extended=True, result_expires=3600, worker_send_task_events=True, ) app: Final = make_celery_worker_app_stub()( main=__name__, result_backend=CELERY_RESULT_URL, broker="%s" % (BASE_CELERY_BROKER_URL), set_as_current=False, ) @app.task( bind=True, queue="my_queue", name="my_name:my_function", acks_late=True, task_reject_on_worker_lost=True, autoretry_for=(Exception,), retry_backoff=True, max_retries=3, task_time_limit=8, ) def failing_function( self: Task, data ) -> None: print(data) # prints hello print(self.request.properties["application_headers"]) assert False == True

What Broke

Tasks failed to retain custom headers during retries, leading to incorrect task behavior.

Why It Broke

Custom headers were not initialized during task retries, causing loss of header information

Fix Options (Details)

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

pip install celery==5.3.0a1

When NOT to use: Do not use this fix if custom headers are required to be separated from internal properties.

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/7555

First fixed release: 5.3.0a1

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 custom headers are required to be separated from internal properties.

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
48.433839 Broken
49.447913 Broken
5.3.0a1 Fixed

Related Issues

No related fixes found.

Sources

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