Jump to solution
Verify

The Fix

pip install celery==4.4.0rc5

Based on closed celery/celery issue #5340 · 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
@@ -729,6 +729,10 @@ def send_task(self, name, args=None, kwargs=None, countdown=None, parent_id = parent.request.id + if conf.task_inherit_parent_priority: + options.setdefault('priority', + parent.request.delivery_info.get('priority'))
repro.py
def basic_publish(self, body, exchange='', routing_key='', mandatory=False, immediate=False, **properties): if isinstance(body, tuple): body, properties = body elif isinstance(body, self.Message): body, properties = body.body, body.properties return self.connection._basic_publish( self.channel_id, body, exchange, routing_key, properties, mandatory or False, immediate or False, ) E TypeError: an integer is required (got type NoneType)
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==4.4.0rc5\nWhen NOT to use: This fix is not applicable if task priority is intentionally set to None.\n\n

Why This Fix Works in Production

  • Trigger: def basic_publish(self, body, exchange='', routing_key='',
  • Mechanism: Passing None as priority to librabbitmq-c causes a TypeError
  • Why the fix works: Allows child tasks to inherit priority from the parent task, addressing the issue of NoneType being passed as priority. (first fixed release: 4.4.0rc5).
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

  • Passing None as priority to librabbitmq-c causes a TypeError
  • Surfaces as: def basic_publish(self, body, exchange='', routing_key='',

Proof / Evidence

  • GitHub issue: #5340
  • Fix PR: https://github.com/celery/celery/pull/5313
  • First fixed release: 4.4.0rc5
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.75
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.40

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“Found the timing doesn't match: the PR which introduced above change was merged 3 days ago, and this issue is 8 days old, so the…”
@madprogrammer · 2019-02-22 · confirmation · source
“@auvipy, is the usage of librabbitmq still actual optimization tip? (in 4693 you said it's not true)”
@vzhadeyev · 2019-03-13 · source
“@madprogrammer could you share some insight in this regard?”
@auvipy · 2019-02-22 · source
“@madprogrammer Faced the same problem with celery 4.2.1 release and librabbitmq, so 7018d9e doesn't seem to be the origin of this bug. Btw setting priority…”
@vzhadeyev · 2019-03-06 · source

Failure Signature (Search String)

  • def basic_publish(self, body, exchange='', routing_key='',

Error Message

Stack trace
error.txt
Error Message ------------- def basic_publish(self, body, exchange='', routing_key='', mandatory=False, immediate=False, **properties): if isinstance(body, tuple): body, properties = body elif isinstance(body, self.Message): body, properties = body.body, body.properties return self.connection._basic_publish( self.channel_id, body, exchange, routing_key, properties, mandatory or False, immediate or False, ) E TypeError: an integer is required (got type NoneType)

Minimal Reproduction

repro.py
def basic_publish(self, body, exchange='', routing_key='', mandatory=False, immediate=False, **properties): if isinstance(body, tuple): body, properties = body elif isinstance(body, self.Message): body, properties = body.body, body.properties return self.connection._basic_publish( self.channel_id, body, exchange, routing_key, properties, mandatory or False, immediate or False, ) E TypeError: an integer is required (got type NoneType)

What Broke

Tasks fail to execute due to raised exceptions when priority is not set.

Why It Broke

Passing None as priority to librabbitmq-c causes a TypeError

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install celery==4.4.0rc5

When NOT to use: This fix is not applicable if task priority is intentionally set to None.

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/5313

First fixed release: 4.4.0rc5

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 is not applicable if task priority is intentionally set to None.

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