The Fix
pip install celery==5.5.0
Based on closed celery/celery issue #9254 · 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.
@@ -1 +1 @@
@@ -1 +1 @@
-pymongo[srv]>=4.0.2, <4.9
+pymongo>=4.3, <4.9
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3097, in requires
deps.extend(dm[safe_extra(ext)])
KeyError: 'srv'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver/bin/weaver", line 33, in <module>
sys.exit(load_entry_point('weaver', 'console_scripts', 'weaver')())
File "/home/francis/dev/conda/envs/weaver/bin/weaver", line 25, in importlib_load_entry_point
return next(matches).load()
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
module = import_module(match.group('module'))
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/francis/dev/weaver/weaver/cli.py", line 17, in <module>
from pyramid.httpexceptions import HTTPNotImplemented
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pyramid/httpexceptions.py", line 139, in <module>
from pyramid.util import text_
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pyramid/util.py", line 8, in <module>
from pyramid.path import DottedNameResolver as _DottedNameResolver
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pyramid/path.py", line 3, in <module>
import pkg_resources
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3657, in <module>
def _initialize_master_working_set():
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3640, in _call_aside
f(*args, **kwargs)
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3669, in _initialize_master_working_set
working_set = _declare_state('object', 'working_set', WorkingSet._build_master())
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 656, in _build_master
ws.require(__requires__)
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1063, in require
needed = self.resolve(parse_requirements(requirements))
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 895, in resolve
new_requirements = dist.requires(req.extras)[::-1]
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3099, in requires
raise UnknownExtra(
pkg_resources.UnknownExtra: pymongo 4.8.0 has no such extra feature 'srv'
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==5.5.0\nWhen NOT to use: Do not apply this fix if you rely on the `[srv]` extra for your MongoDB connections.\n\nOption C — Workaround\nPR fix: https://github.com/crim-ca/weaver/pull/709\nWhen NOT to use: Do not apply this fix if you rely on the `[srv]` extra for your MongoDB connections.\n\n
Why This Fix Works in Production
- Trigger: deps.extend(dm[safe_extra(ext)])
- Mechanism: Updated the MongoDB requirements to remove the deprecated `[srv]` extra requirement, fixing the issue with `pymongo==4.8.0`.
- Why the fix works: Updated the MongoDB requirements to remove the deprecated `[srv]` extra requirement, fixing the issue with `pymongo==4.8.0`. (first fixed release: 5.5.0).
- 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.10 in real deployments (not just unit tests).
- Surfaces as: Traceback (most recent call last):
Proof / Evidence
- GitHub issue: #9254
- Fix PR: https://github.com/celery/celery/pull/9258
- First fixed release: 5.5.0
- 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.27
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@thedrow PR opened: https://github.com/celery/celery/pull/9258”
Failure Signature (Search String)
- deps.extend(dm[safe_extra(ext)])
Error Message
Stack trace
Error Message
-------------
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3097, in requires
deps.extend(dm[safe_extra(ext)])
KeyError: 'srv'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver/bin/weaver", line 33, in <module>
sys.exit(load_entry_point('weaver', 'console_scripts', 'weaver')())
File "/home/francis/dev/conda/envs/weaver/bin/weaver", line 25, in importlib_load_entry_point
return next(matches).load()
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
module = import_module(match.group('module'))
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/francis/dev/weaver/wea
... (truncated) ...
Minimal Reproduction
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3097, in requires
deps.extend(dm[safe_extra(ext)])
KeyError: 'srv'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/francis/dev/conda/envs/weaver/bin/weaver", line 33, in <module>
sys.exit(load_entry_point('weaver', 'console_scripts', 'weaver')())
File "/home/francis/dev/conda/envs/weaver/bin/weaver", line 25, in importlib_load_entry_point
return next(matches).load()
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
module = import_module(match.group('module'))
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/francis/dev/weaver/weaver/cli.py", line 17, in <module>
from pyramid.httpexceptions import HTTPNotImplemented
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pyramid/httpexceptions.py", line 139, in <module>
from pyramid.util import text_
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pyramid/util.py", line 8, in <module>
from pyramid.path import DottedNameResolver as _DottedNameResolver
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pyramid/path.py", line 3, in <module>
import pkg_resources
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3657, in <module>
def _initialize_master_working_set():
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3640, in _call_aside
f(*args, **kwargs)
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3669, in _initialize_master_working_set
working_set = _declare_state('object', 'working_set', WorkingSet._build_master())
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 656, in _build_master
ws.require(__requires__)
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1063, in require
needed = self.resolve(parse_requirements(requirements))
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 895, in resolve
new_requirements = dist.requires(req.extras)[::-1]
File "/home/francis/dev/conda/envs/weaver/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3099, in requires
raise UnknownExtra(
pkg_resources.UnknownExtra: pymongo 4.8.0 has no such extra feature 'srv'
Environment
- Python: 3.10
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install celery==5.5.0
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Option C — Workaround Temporary workaround
PR fix: https://github.com/crim-ca/weaver/pull/709
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
Option D — Guard side-effects with OnceOnly Guardrail for side-effects
Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.
- Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
- Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
- Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
from onceonly import OnceOnly
import os
once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True)
# Stable idempotency key per real side-effect.
# Use a request id / job id / webhook delivery id / Stripe event id, etc.
event_id = "evt_..." # replace
key = f"stripe:webhook:{event_id}"
res = once.check_lock(key=key, ttl=3600)
if res.duplicate:
return {"status": "already_processed"}
# Safe to execute the side-effect exactly once.
handle_event(event_id)
Fix reference: https://github.com/celery/celery/pull/9258
First fixed release: 5.5.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not apply this fix if you rely on the `[srv]` extra for your MongoDB connections.
- Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.
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 |
|---|---|
| 5.5.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.