Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -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',
repro.py
@click.option('optimization', '-O', default='default', cls=CeleryOption, type=click.Choice(('default', 'fair')), help_group="Worker Options", help="Apply optimization profile.")
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
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).
Production impact:
  • 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?”
@stuart-bradley · 2023-06-05 · source
“Made the fix myself if someone can review: #8312”
@stuart-bradley · 2023-06-13 · source
“Hey @stuart-bradley :wave:, Thank you for opening an issue”
@open-collective-bot · 2023-05-02 · source
“@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…”
@auvipy · 2023-05-02 · source

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
signature.txt
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.txt
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

repro.py
@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

When NOT to use: This fix should not be used if the CLI behavior needs to remain consistent with previous versions.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

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

verify
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

VersionStatus
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.