The Fix
pip install celery==5.0.1
Based on closed celery/celery issue #6186 · 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.
@@ -428,6 +428,7 @@ def _task_from_fun(self, fun, name=None, base=None, bind=False, **options):
'__doc__': fun.__doc__,
'__module__': fun.__module__,
+ '__annotations__': fun.__annotations__,
'__header__': staticmethod(head_from_fun(fun, bound=bind)),
'__wrapped__': run}, **options))()
@functools.wraps(decorated_function, assigned=('__annotations__',))
@celery_app.task(bind=True, base=base, priority=priority, name=name)
def task(): ...
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install celery==5.0.1\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n
Why This Fix Works in Production
- Trigger: - [x] I have included all related issues and possible duplicate issues
- Mechanism: The task decorator does not copy __annotations__ from the decorated function
- Why the fix works: Enables getting type hints for tasks by copying __annotations__ when creating tasks. (first fixed release: 5.0.1).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Triggered by an upgrade/regression window: 3.0–3.6 breaks; 5.0.1 is the first fixed release.
- Shows up under Python 3.0 in real deployments (not just unit tests).
- The task decorator does not copy __annotations__ from the decorated function
- Production symptom (often without a traceback): - [x] I have included all related issues and possible duplicate issues
Proof / Evidence
- GitHub issue: #6186
- Fix PR: https://github.com/celery/celery/pull/6419
- First fixed release: 5.0.1
- Affected versions: 3.0–3.6
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.62
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“#6419 is open”
“Thanks! Please let me know if help is needed for this to be implemented.”
“for celery 4.5 which will be python 3.6+ only”
“For anyone finding this before it's fixed, I have the following work-around:”
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
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 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
@functools.wraps(decorated_function, assigned=('__annotations__',))
@celery_app.task(bind=True, base=base, priority=priority, name=name)
def task(): ...
Environment
- Python: 3.0
Why It Broke
The task decorator does not copy __annotations__ from the decorated function
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==5.0.1
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/6419
First fixed release: 5.0.1
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
Verify Fix
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
| Version | Status |
|---|---|
| 3.0 | Broken |
| 3.6 | Broken |
| 5.0.1 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.