The Fix
pip install celery==4.4.0rc5
Based on closed celery/celery issue #5548 · 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.
@@ -531,6 +531,18 @@ def apply_async(self, args=None, kwargs=None, task_id=None, producer=None,
check_arguments(*(args or ()), **(kwargs or {}))
+ if self.__v2_compat__:
+ shadow = shadow or self.shadow_name(self(), args, kwargs, options)
+ else:
def test_always_eager_with_task_serializer_option(self):
self.app.conf.task_always_eager = True
@self.app.task(serializer='pickle')
def task(*args, **kwargs):
pass
task.apply_async((1, 2, 3, 4, {1}))
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==4.4.0rc5\nWhen NOT to use: Do not use this fix if you rely on the previous behavior of ignoring the serializer.\n\n
Why This Fix Works in Production
- Trigger: Error `kombu.exceptions.EncodeError: Object of type set is not JSON serializable`
- Mechanism: The task serializer is ignored when CELERY_ALWAYS_EAGER is set to True
- Why the fix works: Fixes the issue where the task serializer is ignored when CELERY_ALWAYS_EAGER is set to True. (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 task serializer is ignored when CELERY_ALWAYS_EAGER is set to True
- Surfaces as: Error `kombu.exceptions.EncodeError: Object of type set is not JSON serializable`
Proof / Evidence
- GitHub issue: #5548
- Fix PR: https://github.com/celery/celery/pull/5549
- 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.61
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Would be really really nice if the fix could go out as 4.3.1 unless the 4.4.0 release is imminent. Our task with custom serialiser is…”
Failure Signature (Search String)
- Error `kombu.exceptions.EncodeError: Object of type set is not JSON serializable`
Error Message
Stack trace
Error Message
-------------
Error `kombu.exceptions.EncodeError: Object of type set is not JSON serializable`
Minimal Reproduction
def test_always_eager_with_task_serializer_option(self):
self.app.conf.task_always_eager = True
@self.app.task(serializer='pickle')
def task(*args, **kwargs):
pass
task.apply_async((1, 2, 3, 4, {1}))
What Broke
Tasks with custom serializers fail to serialize correctly in eager mode.
Why It Broke
The task serializer is ignored when CELERY_ALWAYS_EAGER is set to True
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/5549
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 rely on the previous behavior of ignoring the serializer.
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 |
|---|---|
| 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.