The Fix
pip install celery==4.4.0rc5
Based on closed celery/celery issue #4498 · 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%.
@@ -779,10 +779,9 @@ class chain(_chain):
# This forces `chain(X, Y, Z)` to work the same way as `X | Y | Z`
if not kwargs and tasks:
- if len(tasks) == 1 and is_list(tasks[0]):
- # ensure chain(generator_expression) works.
- tasks = tasks[0]
import celery
@celery.task
def foo():
print("hello, world")
f = foo.apply_async()
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 the task chaining behavior is intentionally designed to be different.\n\n
Why This Fix Works in Production
- Trigger: (celery) ➜ myapp git:(master) ./manage.py test_cmd
- Mechanism: The chain implementation did not handle single task chains correctly
- Why the fix works: Fixes the issue where a chain with one task does not run as expected by modifying the chain implementation. (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 3.6 in real deployments (not just unit tests).
- The chain implementation did not handle single task chains correctly
- Surfaces as: (celery) ➜ myapp git:(master) ./manage.py test_cmd
Proof / Evidence
- GitHub issue: #4498
- Fix PR: https://github.com/celery/celery/pull/4730
- 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.25
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@xbogdan - chain reduces to X | Y | Z if there are no kwargs, which means that chain(AddTask().si(1,2)) will return that signature object, not…”
“Hi I think it's not just chains, here's a simpler test case: Output:”
“@davmlaw can you try binding the task, just to check if this gives us more insight:”
Failure Signature (Search String)
- (celery) ➜ myapp git:(master) ./manage.py test_cmd
Error Message
Stack trace
Error Message
-------------
(celery) ➜ myapp git:(master) ./manage.py test_cmd
Traceback (most recent call last):
File "./manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/Users/admin/Projects/myapp/cel/management/commands/test_cmd.py", line 10, in handle
c = chain(AddTask().si(1, 2), AddTask().si(1, 2))()
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/celery/canvas.py", line 533, in __call__
return self.apply_async(args, kwargs)
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/celery/canvas.py", line 559, in apply_async
dict(self.options, **options) if options else self.options))
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/celery/canvas.py", line 586, in run
first_task
... (truncated) ...
Stack trace
Error Message
-------------
(celery) ➜ myapp git:(master) ./manage.py test_cmd
Traceback (most recent call last):
File "./manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/Users/admin/Projects/myapp/cel/management/commands/test_cmd.py", line 10, in handle
c = chain(AddTask().si(1, 2))()
File "/Users/admin/Envs/celery/lib/python3.6/site-packages/celery/canvas.py", line 178, in __call__
return self.type(*args, **kwargs)
TypeError: object() takes no parameters
Stack trace
Error Message
-------------
TypeError Traceback (most recent call last)
<ipython-input-4-686caed5db4b> in <module>()
----> 1 f = foo.apply_async()
/usr/local/lib/python3.5/dist-packages/celery/app/task.py in apply_async(self, args, kwargs, task_id, producer, link, link_error, shadow, **options)
530 args = args if isinstance(args, tuple) else tuple(args or ())
531 args = (self.__self__,) + args
--> 532 shadow = shadow or self.shadow_name(args, kwargs, options)
533
534 preopts = self._get_exec_options()
TypeError: shadow_name() missing 1 required positional argument: 'options'
Minimal Reproduction
import celery
@celery.task
def foo():
print("hello, world")
f = foo.apply_async()
Environment
- Python: 3.6
What Broke
Tasks in a chain with one task do not execute as expected, leading to failures.
Why It Broke
The chain implementation did not handle single task chains correctly
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.
Option D — Guard side-effects with OnceOnly Guardrail for side-effects
Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.
- Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
- Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
- Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
from onceonly import OnceOnly
import os
once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True)
# Stable idempotency key per real side-effect.
# Use a request id / job id / webhook delivery id / Stripe event id, etc.
event_id = "evt_..." # replace
key = f"stripe:webhook:{event_id}"
res = once.check_lock(key=key, ttl=3600)
if res.duplicate:
return {"status": "already_processed"}
# Safe to execute the side-effect exactly once.
handle_event(event_id)
Fix reference: https://github.com/celery/celery/pull/4730
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 task chaining behavior is intentionally designed to be different.
- Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.
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
- Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
- Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.
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.