The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #1639 · 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%.
@@ -2922,16 +2922,22 @@ def script_debug(self, *args):
)
- def script_flush(self, sync_type="SYNC"):
+ def script_flush(self, sync_type=None):
"""Flush all scripts from the script cache.
(assuming a Redis server on localhost):
Follow the reproduction steps, confirm the failure, apply the fix, and repeat the same steps to verify the behavior changes.
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n
Why This Fix Works in Production
- Trigger: 4.0.0b1 breaks script_flush on pre-6.2 server
- Mechanism: Modifies the script_flush method to default to None for pre-6.2 Redis servers, resolving compatibility issues.
- Why the fix works: Modifies the script_flush method to default to None for pre-6.2 Redis servers, resolving compatibility issues. (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
- Shows up under Python 3.8.10 in real deployments (not just unit tests).
- Production symptom (often without a traceback): 4.0.0b1 breaks script_flush on pre-6.2 server
Proof / Evidence
- GitHub issue: #1639
- Fix PR: https://github.com/redis/redis-py/pull/1641
- First fixed release: 7.1.0
- Reproduced locally: No (not executed)
- Last verified: 2026-02-07
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.63
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Thank you for reporting @bmerry”
Failure Signature (Search String)
- 4.0.0b1 breaks script_flush on pre-6.2 server
- **Description**: In 4.0.0b1, the implementation of `script_flush` always calls either `SCRIPT FLUSH SYNC` or `SCRIPT FLUSH ASYNC` on the server. However, the SYNC/ASYNC modifier
Copy-friendly signature
Failure Signature
-----------------
4.0.0b1 breaks script_flush on pre-6.2 server
**Description**: In 4.0.0b1, the implementation of `script_flush` always calls either `SCRIPT FLUSH SYNC` or `SCRIPT FLUSH ASYNC` on the server. However, the SYNC/ASYNC modifier was only added in Redis 6.2, making it fail on older versions.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
4.0.0b1 breaks script_flush on pre-6.2 server
**Description**: In 4.0.0b1, the implementation of `script_flush` always calls either `SCRIPT FLUSH SYNC` or `SCRIPT FLUSH ASYNC` on the server. However, the SYNC/ASYNC modifier was only added in Redis 6.2, making it fail on older versions.
Minimal Reproduction
- (assuming a Redis server on localhost):
Environment
- Python: 3.8.10
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/1641
First fixed release: 7.1.0
Last verified: 2026-02-07. Validate in your environment.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
Verify Fix
Follow the reproduction steps, confirm the failure, apply the fix, and repeat the same steps to verify the behavior changes.
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.