The Fix
pip install celery==4.4.0rc5
Based on closed celery/celery issue #4810 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -655,7 +655,8 @@ def autodiscover_tasks(self, packages=None,
related_name (str): The name of the module to find. Defaults
to "tasks": meaning "look for 'module.tasks' for every
- module in ``packages``."
+ module in ``packages``.". If ``None`` will only try to import
+ the package, i.e. "look for 'module'".
Option A — Upgrade to fixed release\npip install celery==4.4.0rc5\nWhen NOT to use: Do not use this fix if you require strict related_name suffixes for task discovery.\n\n
Why This Fix Works in Production
- Trigger: Autodiscovery fails for empty "related_name"
- Mechanism: The autodiscover_tasks function fails with a KeyError when related_name is empty
- Why the fix works: Allows passing 'related_name=None' for autodiscovery, enabling the import of the plain package without a specific suffix. (first fixed release: 4.4.0rc5).
- 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
- Shows up under Python 2.7 in real deployments (not just unit tests).
- The autodiscover_tasks function fails with a KeyError when related_name is empty
- Production symptom (often without a traceback): Autodiscovery fails for empty "related_name"
Proof / Evidence
- GitHub issue: #4810
- Fix PR: https://github.com/celery/celery/pull/4813
- First fixed release: 4.4.0rc5
- 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.71
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“This seems to boil down to a Python 2.7 vs 3.x issue”
“I've already opened https://github.com/celery/celery/pull/4813”
Failure Signature (Search String)
- Autodiscovery fails for empty "related_name"
Copy-friendly signature
Failure Signature
-----------------
Autodiscovery fails for empty "related_name"
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Autodiscovery fails for empty "related_name"
Environment
- Python: 2.7
What Broke
Users experience KeyError when attempting to autodiscover tasks with an empty related_name.
Why It Broke
The autodiscover_tasks function fails with a KeyError when related_name is empty
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==4.4.0rc5
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/4813
First fixed release: 4.4.0rc5
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if you require strict related_name suffixes for task discovery.
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 |
|---|---|
| 4.4.0rc5 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.