The Fix
pip install celery==5.3.4
Based on closed celery/celery issue #8372 · 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%.
@@ -282,7 +282,10 @@ def apply_entry(self, entry, producer=None):
exc, traceback.format_stack(), exc_info=True)
else:
- debug('%s sent. id->%s', entry.task, result.id)
+ if result and hasattr(result, 'id'):
+ debug('%s sent. id->%s', entry.task, result.id)
Option A — Upgrade to fixed release\npip install celery==5.3.4\nWhen NOT to use: Do not use this fix if the task's result is expected to be None intentionally.\n\n
Why This Fix Works in Production
- Trigger: result.id is causing celery beat to fail when using transaction.on_commit()
- Mechanism: Modifies the debug logging statement in celery.beat.apply_entry() to safely handle cases where the result may be None, preventing AttributeError when using transaction.on_commit.
- Why the fix works: Modifies the debug logging statement in celery.beat.apply_entry() to safely handle cases where the result may be None, preventing AttributeError when using transaction.on_commit. (first fixed release: 5.3.4).
- 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.8 in real deployments (not just unit tests).
- Production symptom (often without a traceback): result.id is causing celery beat to fail when using transaction.on_commit()
Proof / Evidence
- GitHub issue: #8372
- Fix PR: https://github.com/celery/celery/pull/8428
- First fixed release: 5.3.4
- 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.60
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“i get this error too; to get unblocked i just don't use transaction.on_commit with Celery tasks invoked via Beat. would be nice not to have…”
“I am open to accept any improvement here with appropriate test cases”
“please don't worry about mistakes. come with a draft PR with what you suggested in your last comment.”
“@auvipy i created https://github.com/celery/celery/pull/8428”
Failure Signature (Search String)
- result.id is causing celery beat to fail when using transaction.on_commit()
- We have transaction.on_commit wrapper for out celery tasks which defers the execution of task until the transaction is committed to database. In that case the result returned will
Copy-friendly signature
Failure Signature
-----------------
result.id is causing celery beat to fail when using transaction.on_commit()
We have transaction.on_commit wrapper for out celery tasks which defers the execution of task until the transaction is committed to database. In that case the result returned will be None and celery beat will fail with this error:
Error Message
Signature-only (no traceback captured)
Error Message
-------------
result.id is causing celery beat to fail when using transaction.on_commit()
We have transaction.on_commit wrapper for out celery tasks which defers the execution of task until the transaction is committed to database. In that case the result returned will be None and celery beat will fail with this error:
Environment
- Python: 3.8
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==5.3.4
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/8428
First fixed release: 5.3.4
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the task's result is expected to be None intentionally.
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.4 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.