You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] CouchbaseBackend.mget() is incompatible with couchbase SDK >= 4 (get_multi returns MultiGetResult) #10694
CouchbaseBackend.mget() is still written against the couchbase SDK 3.x API. On couchbase >= 4.0 (verified against 4.6.3), collection.get_multi() returns a couchbase.result.MultiGetResult object instead of a list of values, and per-key failures are collected on that object instead of being raised. mget() passes that object straight through:
KeyValueStoreBackend._mget_to_results() (celery/backends/base.py) then fails on both of its branches:
MultiGetResult has no .items() (public surface is all_ok / exceptions / results), so the dict branch is skipped;
MultiResult defines no __iter__, so the list branch's enumerate(values) raises TypeError: 'MultiGetResult' object is not iterable.
Additionally, with return_exceptions semantics, keys whose documents are missing surface as DocumentNotFoundException entries in results/exceptions rather than as None — the KeyValueStoreBackend contract (get() → None for absent keys) is not honoured for the multi path either.
Impact
backend.get_many(...) / AsyncResult group operations that go through mget() crash with TypeError on SDK >= 4.
then any get_many() against a CouchbaseBackend on couchbase 4.6.3 raises TypeError inside _mget_to_results.
Possible direction
Implement mget() against collection.get_multi(keys, return_exceptions=True) and translate the MultiGetResult.results mapping: successful GetResult → .content, per-key DocumentNotFoundException → None (matching the KV contract), other per-key exceptions → re-raise. The dict-shaped result can then be handed to _mget_to_results()'s existing dict branch (full celery-task-meta keys map through values.items()).
Found during review of #10680 (point 2, @MehrazRumman); verified against couchbase SDK 4.6.3 on celery main.
Activity
auvipy commentedon Sep 22, 2026
@simpleqt can you fix it?
Fix CouchbaseBackend.mget() for couchbase SDK >= 4
simpleqt commentedon Sep 22, 2026
auvipy commentedon Sep 22, 2026
thanks a lot!
fix(backends/couchbase): missing document raises instead of returning…