The Fix
pip install celery==5.2.0rc2
Based on closed celery/celery issue #6857 · 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.
@@ -144,6 +144,8 @@ def inspect(ctx, action, timeout, destination, json, **kwargs):
if json:
ctx.obj.echo(dumps(replies))
+ return
+
nodecount = len(replies)
this bug.
Follow the reproduction steps, confirm the failure, apply the fix, and repeat the same steps to verify the behavior changes.
Option A — Upgrade to fixed release\npip install celery==5.2.0rc2\nWhen NOT to use: This fix is not applicable if you require the additional output for monitoring.\n\n
Why This Fix Works in Production
- Trigger: Celery inspect output JSON serialization is broken
- Mechanism: The inspect command outputs additional text that invalidates the JSON format
- Why the fix works: Fixes the inspect command's JSON output to be valid without requiring the --quiet flag. (first fixed release: 5.2.0rc2).
- If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).
Why This Breaks in Prod
- The inspect command outputs additional text that invalidates the JSON format
- Production symptom (often without a traceback): Celery inspect output JSON serialization is broken
Proof / Evidence
- GitHub issue: #6857
- Fix PR: https://github.com/celery/celery/pull/6866
- First fixed release: 5.2.0rc2
- 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.77
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“you probably want to use --quiet here: edit: docs: https://docs.celeryproject.org/en/stable/reference/cli.html#cmdoption-celery-q if --json should imply the --quiet argument, we might want to change it this way”
“Hey @adampl :wave:, Thank you for opening an issue”
“Thanks, that makes sense, as I think no one needs the extra output if they ask for JSON :)”
Failure Signature (Search String)
- Celery inspect output JSON serialization is broken
- - [x] I have included all related issues and possible duplicate issues
Copy-friendly signature
Failure Signature
-----------------
Celery inspect output JSON serialization is broken
- [x] I have included all related issues and possible duplicate issues
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Celery inspect output JSON serialization is broken
- [x] I have included all related issues and possible duplicate issues
Minimal Reproduction
- this bug.
What Broke
Invalid JSON output causes issues in automated processing of command results.
Why It Broke
The inspect command outputs additional text that invalidates the JSON format
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==5.2.0rc2
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/6866
First fixed release: 5.2.0rc2
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if you require the additional output for monitoring.
Verify Fix
Follow the reproduction steps, confirm the failure, apply the fix, and repeat the same steps to verify the behavior changes.
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 |
|---|---|
| 5.2.0rc2 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.