The Fix
pip install celery==4.4.0rc5
Based on closed celery/celery issue #5734 · 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.
@@ -157,6 +157,10 @@ def _get_connection(self):
conf = dict(self.options)
conf['host'] = host
+ if self.user:
+ conf['username'] = self.user
+ if self.password:
software -> celery:4.3.0 (rhubarb) kombu:4.6.4 py:3.7.4
billiard:3.6.1.0 py-amqp:2.5.1
platform -> system:Windows arch:64bit, WindowsPE
kernel version:10 imp:CPython
loader -> celery.loaders.default.Loader
settings -> transport:amqp results:disabled
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install celery==4.4.0rc5\nWhen NOT to use: Do not use this fix if the MongoDB connection does not require authentication.\n\n
Why This Fix Works in Production
- Trigger: return obj.__dict__[self.__name__]
- Mechanism: Username must be provided if 'authMechanism' is used while connecting to MongoDB
- Why the fix works: Fixes issue #5734 by ensuring that the username and password are included when connecting to MongoDB with an authMechanism. (first fixed release: 4.4.0rc5).
- 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
- Username must be provided if 'authMechanism' is used while connecting to MongoDB
- Surfaces as: Traceback (most recent call last):
Proof / Evidence
- GitHub issue: #5734
- Fix PR: https://github.com/celery/celery/pull/5795
- First fixed release: 4.4.0rc5
- 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.34
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“raise ConfigurationError("%s requires a username." % (mech,)) pymongo.errors.ConfigurationError: SCRAM-SHA-256 requires a username. did you provide the username?”
“@auvipy, thanks for your reply”
Failure Signature (Search String)
- return obj.__dict__[self.__name__]
Error Message
Stack trace
Error Message
-------------
Traceback (most recent call last):
File "D:\GitHub\org\dev\.venv\lib\site-packages\kombu\utils\objects.py", line 42, in __get__
return obj.__dict__[self.__name__]
KeyError: 'collection'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\GitHub\org\dev\.venv\lib\site-packages\kombu\utils\objects.py", line 42, in __get__
return obj.__dict__[self.__name__]
KeyError: 'database'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\user\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\ptvsd_launcher.py", line 43, in <module>
main(ptvsdArgs)
File "c:\Users\user\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\lib\python\ptvsd\__main__.py", line 432, in main
run()
File "c:\Users\user\.vscode\extensions\ms-python.python-2019.9.34911\pythonFiles\lib\python\ptvsd\__main__.py", line 316, in run_file
runpy.run_path(target, run_name='__main__')
File "C:\Program Files\Python37\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Program Files\Python37\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Program Files\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "d:\GitHub\org\dev\backend\te
... (truncated) ...
Minimal Reproduction
software -> celery:4.3.0 (rhubarb) kombu:4.6.4 py:3.7.4
billiard:3.6.1.0 py-amqp:2.5.1
platform -> system:Windows arch:64bit, WindowsPE
kernel version:10 imp:CPython
loader -> celery.loaders.default.Loader
settings -> transport:amqp results:disabled
What Broke
Connection attempts fail with a configuration error due to missing username.
Why It Broke
Username must be provided if 'authMechanism' is used while connecting to MongoDB
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==4.4.0rc5
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/5795
First fixed release: 4.4.0rc5
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the MongoDB connection does not require authentication.
Verify Fix
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
| Version | Status |
|---|---|
| 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.