The Fix
pip install celery==4.4.0rc5
Based on closed celery/celery issue #5133 · 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%.
@@ -531,14 +531,17 @@ def apply_async(self, args=None, kwargs=None, task_id=None, producer=None,
with app.producer_or_acquire(producer) as eager_producer:
serializer = options.get(
- 'serializer', eager_producer.serializer
+ 'serializer',
+ (eager_producer.serializer if eager_producer.serializer
Option A — Upgrade to fixed release\npip install celery==4.4.0rc5\nWhen NOT to use: Do not use this fix if the application relies on a specific serializer behavior that differs from the default.\n\n
Why This Fix Works in Production
- Trigger: If you are using the pickle serializer, and you call the task with `serializer='pickle'` an `ContentDisallowed` exception will be raised.
- Mechanism: The eager task serializer defaults to JSON due to the producer's serializer being set to None
- Why the fix works: Fixes the issue where eager tasks ignore the CELERY_*_SERIALIZER settings by ensuring the correct serializer is used during serialization. (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
- The eager task serializer defaults to JSON due to the producer's serializer being set to None
- Production symptom (often without a traceback): If you are using the pickle serializer, and you call the task with `serializer='pickle'` an `ContentDisallowed` exception will be raised.
Proof / Evidence
- GitHub issue: #5133
- Fix PR: https://github.com/celery/celery/pull/5342
- 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.70
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@muzhig Any steps to reproduce this issue? At first glance that code looks OK.”
“I have this issue as well. The producer returned from app.producer_or_acquire(producer) has its serializer attribute set to None. When serializer.dumps is called with serializer=None it…”
“If you are using the pickle serializer, and you call the task with serializer='pickle' an ContentDisallowed exception will be raised.”
“I've submitted a PR to fix this issue: https://github.com/celery/celery/pull/5342”
Failure Signature (Search String)
- If you are using the pickle serializer, and you call the task with `serializer='pickle'` an `ContentDisallowed` exception will be raised.
Copy-friendly signature
Failure Signature
-----------------
If you are using the pickle serializer, and you call the task with `serializer='pickle'` an `ContentDisallowed` exception will be raised.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
If you are using the pickle serializer, and you call the task with `serializer='pickle'` an `ContentDisallowed` exception will be raised.
What Broke
Eager tasks fail to serialize correctly, leading to exceptions when using non-default serializers.
Why It Broke
The eager task serializer defaults to JSON due to the producer's serializer being set to None
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/5342
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 the application relies on a specific serializer behavior that differs from the default.
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.