The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #3059 · PR/commit linked
@@ -97,6 +97,7 @@ def acl_genpass(self, bits: Union[int, None] = None, **kwargs) -> ResponseT:
if b < 0 or b > 4096:
raise ValueError
+ pieces.append(b)
except ValueError:
raise DataError(
from redis import Redis
url = "redis://localhost:6379/1"
rdb = Redis.from_url(url)
print(rdb.acl_genpass(32))
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 you require the previous behavior of acl_genpass.\n\n
Why This Fix Works in Production
- Trigger: raise ValueError
- Mechanism: The acl_genpass method did not correctly handle the bits argument, leading to unexpected password lengths
- Why the fix works: Fixes the acl_genpass method to correctly handle the bits argument. (first fixed release: 7.1.0).
Why This Breaks in Prod
- The acl_genpass method did not correctly handle the bits argument, leading to unexpected password lengths
- Production symptom (often without a traceback): raise ValueError
Proof / Evidence
- GitHub issue: #3059
- Fix PR: https://github.com/redis/redis-py/pull/3062
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-08
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.70
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Thanks for wanting to report an issue you've found in redis-py. Please delete this text and fill in the template below. It is of course not always possible to reduce your code to a small test case, but it's highly appreciated to have as muc”
Failure Signature (Search String)
- raise ValueError
- except ValueError:
Copy-friendly signature
Failure Signature
-----------------
raise ValueError
except ValueError:
Error Message
Signature-only (no traceback captured)
Error Message
-------------
raise ValueError
except ValueError:
Minimal Reproduction
from redis import Redis
url = "redis://localhost:6379/1"
rdb = Redis.from_url(url)
print(rdb.acl_genpass(32))
What Broke
Users received passwords of incorrect lengths when calling acl_genpass with specific bit values.
Why It Broke
The acl_genpass method did not correctly handle the bits argument, leading to unexpected password lengths
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/3062
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 you require the previous behavior of acl_genpass.
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.