Jump to solution
Verify

The Fix

pip install celery==4.4.0rc5

Based on closed celery/celery issue #4377 · 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
@@ -265,3 +265,4 @@ Tom Booth, 2018/07/06 Bruno Alla, 2018/09/27 Artem Vasilyev, 2018/11/24 +Victor Mireyev, 2018/12/13 diff --git a/celery/backends/base.py b/celery/backends/base.py index e4937f66c6f..58c729254bc 100644
repro.py
from celery import Celery,Task celery = Celery('tasks', broker='redis://localhost:6379/6',backend='redis://localhost:6379/6') @celery.task def ErrTask1(req): print('failure') class CustomTask(Task): def run(self,var): print('running %s' % var) if var == "err": raise Exception("err") CustomTask = celery.register_task(CustomTask()) class ErrTask2(Task): def run(self): print('failure') ErrTask2 = celery.register_task(ErrTask2())
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 should not be used if relying on legacy task registration methods.\n\nOption C — Workaround\nis to define the error callbacks with the task decorator.\nWhen NOT to use: This fix should not be used if relying on legacy task registration methods.\n\n

Why This Fix Works in Production

  • Trigger: Using a class based task as errback results in AttributeError '_header_'
  • Mechanism: Class-based tasks lack the necessary properties for error callbacks, leading to an AttributeError
  • Why the fix works: Fixes the error callback processing for class-based tasks by ensuring they have the necessary properties, addressing the AttributeError encountered in issue #4377. (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

  • Class-based tasks lack the necessary properties for error callbacks, leading to an AttributeError
  • Surfaces as: Using a class based task as errback results in AttributeError '_header_'

Proof / Evidence

  • GitHub issue: #4377
  • Fix PR: https://github.com/celery/celery/pull/5232
  • 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.61

Discussion

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

“PR could be made if you think it makes sense -- basically, our problem in Waldur was that we are still using "legacy" base Task…”
@livenson · 2018-05-23 · confirmation · source
“@AlexHill @georgepsarakis could you check”
@auvipy · 2017-12-20 · source
“I see that this issue #3723 is related too. Edit: Somehow related #4022 too.”
@WoaDmulL · 2018-04-03 · source
“Hi, is there any resolution to this issue? We are facing it on 4.1.0 (and 4.1.1). I see that the task is closed but couldn't…”
@livenson · 2018-05-21 · source

Failure Signature (Search String)

  • Using a class based task as errback results in AttributeError '_header_'

Error Message

Stack trace
error.txt
Error Message ------------- Using a class based task as errback results in AttributeError '_header_'

Minimal Reproduction

repro.py
from celery import Celery,Task celery = Celery('tasks', broker='redis://localhost:6379/6',backend='redis://localhost:6379/6') @celery.task def ErrTask1(req): print('failure') class CustomTask(Task): def run(self,var): print('running %s' % var) if var == "err": raise Exception("err") CustomTask = celery.register_task(CustomTask()) class ErrTask2(Task): def run(self): print('failure') ErrTask2 = celery.register_task(ErrTask2())

What Broke

Using class-based tasks as error callbacks results in AttributeError, causing task failures.

Why It Broke

Class-based tasks lack the necessary properties for error callbacks, leading to an AttributeError

Fix Options (Details)

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

pip install celery==4.4.0rc5

When NOT to use: This fix should not be used if relying on legacy task registration methods.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Option C — Workaround Temporary workaround

is to define the error callbacks with the task decorator.

When NOT to use: This fix should not be used if relying on legacy task registration methods.

Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.

Fix reference: https://github.com/celery/celery/pull/5232

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 should not be used if relying on legacy task registration methods.

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.