The Fix
pip install celery==5.3.1
Based on closed celery/celery issue #8224 · 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%.
@@ -166,8 +166,8 @@ def detach(path, argv, logfile=None, pidfile=None, uid=None,
help_group="Worker Options",
help="Logging level.")
[email protected]('optimization',
- '-O',
[email protected]('-O',
@click.option('optimization',
'-O',
default='default',
cls=CeleryOption,
type=click.Choice(('default', 'fair')),
help_group="Worker Options",
help="Apply optimization profile.")
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.3.1\nWhen NOT to use: This fix should not be used if the CLI behavior needs to remain consistent with previous versions.\n\n
Why This Fix Works in Production
- Trigger: Why has the CLI worker command flag `optimizations` changed from `--optimizations` in 5.*?
- Mechanism: The CLI worker command flag lost its double hyphen due to a change in the underlying library from argparse to click
- Why the fix works: Fixes the worker command optimizations flag which lost its double hyphen, causing breaking behavior in version 5.*. (first fixed release: 5.3.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
- The CLI worker command flag lost its double hyphen due to a change in the underlying library from argparse to click
- Production symptom (often without a traceback): Why has the CLI worker command flag `optimizations` changed from `--optimizations` in 5.*?
Proof / Evidence
- GitHub issue: #8224
- Fix PR: https://github.com/celery/celery/pull/8312
- First fixed release: 5.3.1
- 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).
“Hey team, has there been any movement on this?”
“Made the fix myself if someone can review: #8312”
“Hey @stuart-bradley :wave:, Thank you for opening an issue”
“@thedrow was this an intended change? @stuart-bradley we actually moved the CLI from argparse to click in version 5 on wards, so that might cause…”
Failure Signature (Search String)
- Why has the CLI worker command flag `optimizations` changed from `--optimizations` in 5.*?
- Why has the flag removed the double hyphen? It seems like a bug, but I assume there was a reason for it? The reason I'm asking is that this change breaks a bunch of code we have,
Copy-friendly signature
Failure Signature
-----------------
Why has the CLI worker command flag `optimizations` changed from `--optimizations` in 5.*?
Why has the flag removed the double hyphen? It seems like a bug, but I assume there was a reason for it? The reason I'm asking is that this change breaks a bunch of code we have, so I'd like to understand the change.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Why has the CLI worker command flag `optimizations` changed from `--optimizations` in 5.*?
Why has the flag removed the double hyphen? It seems like a bug, but I assume there was a reason for it? The reason I'm asking is that this change breaks a bunch of code we have, so I'd like to understand the change.
Minimal Reproduction
@click.option('optimization',
'-O',
default='default',
cls=CeleryOption,
type=click.Choice(('default', 'fair')),
help_group="Worker Options",
help="Apply optimization profile.")
What Broke
This change breaks existing code that relies on the previous flag format, causing failures in command execution.
Why It Broke
The CLI worker command flag lost its double hyphen due to a change in the underlying library from argparse to click
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==5.3.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/8312
First fixed release: 5.3.1
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the CLI behavior needs to remain consistent with previous versions.
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 |
|---|---|
| 5.3.1 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.