The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #3392 · 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%.
@@ -58,11 +58,11 @@
# HIDE_END
res7 = r.sinter("bikes:racing:france", "bikes:racing:usa")
-print(res7) # >>> {'bike:1'}
+print(res7) # >>> ['bike:1']
# STEP_END
try:
import hiredis # noqa
# Only support Hiredis >= 3.0:
HIREDIS_AVAILABLE = int(hiredis.__version__.split(".")[0]) >= 3
HIREDIS_PACK_AVAILABLE = hasattr(hiredis, "pack_command")
except ImportError:
HIREDIS_AVAILABLE = False
HIREDIS_PACK_AVAILABLE = False
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: Do not use this fix if hiredis is not installed, as it may lead to unexpected behavior.\n\n
Why This Fix Works in Production
- Trigger: Since `redis-py` updates automatically as it is implicit, it can lead to a version mismatch where `redis-py` is updated, but `hiredis` remains locked to an…
- Mechanism: The redis-py library incorrectly checks for hiredis availability, leading to errors with lower versions
- Why the fix works: Upgrades the required hiredis-py version to be at least 3.0.0 to avoid segmentation faults when parsing RESP3 sets. (first fixed release: 7.1.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
- The redis-py library incorrectly checks for hiredis availability, leading to errors with lower versions
- Production symptom (often without a traceback): Since `redis-py` updates automatically as it is implicit, it can lead to a version mismatch where `redis-py` is updated, but `hiredis` remains locked to an older version, causing an unsynchronized state.
Proof / Evidence
- GitHub issue: #3392
- Fix PR: https://github.com/redis/redis-py/pull/3324
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-08
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.62
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Hi, this bug could be reproduced with redis-py 5.1.0 and hiredis-py 2.4.0”
“With version 5.1.0 I started to face the error message: NameError: name 'hiredis' is not defined The error was introduced by the code inside redis/utils.py…”
“I noticed that in the recent redis-py update (5.1.0), the author forgot to mention the hiredis dependency, although it is mentioned here: Including such a…”
“So I request to add this information on release notes of 5.1.0 :)”
Failure Signature (Search String)
- Since `redis-py` updates automatically as it is implicit, it can lead to a version mismatch where `redis-py` is updated, but `hiredis` remains locked to an older version, causing
- Including such a change in the release log would be quite helpful for other developers.
Copy-friendly signature
Failure Signature
-----------------
Since `redis-py` updates automatically as it is implicit, it can lead to a version mismatch where `redis-py` is updated, but `hiredis` remains locked to an older version, causing an unsynchronized state.
Including such a change in the release log would be quite helpful for other developers.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Since `redis-py` updates automatically as it is implicit, it can lead to a version mismatch where `redis-py` is updated, but `hiredis` remains locked to an older version, causing an unsynchronized state.
Including such a change in the release log would be quite helpful for other developers.
Minimal Reproduction
try:
import hiredis # noqa
# Only support Hiredis >= 3.0:
HIREDIS_AVAILABLE = int(hiredis.__version__.split(".")[0]) >= 3
HIREDIS_PACK_AVAILABLE = hasattr(hiredis, "pack_command")
except ImportError:
HIREDIS_AVAILABLE = False
HIREDIS_PACK_AVAILABLE = False
Why It Broke
The redis-py library incorrectly checks for hiredis availability, leading to errors with lower versions
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install redis==7.1.0
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/redis/redis-py/pull/3324
First fixed release: 7.1.0
Last verified: 2026-02-08. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if hiredis is not installed, as it may lead to unexpected behavior.
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 |
|---|---|
| 7.1.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.