Jump to solution
Details

The Fix

Restores zrange functionality for older versions of Redis by reverting changes made in a previous pull request.

Based on closed redis/redis-py issue #1669 · 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%.

Open PR/Commit
@@ -2520,6 +2520,13 @@ def zrange(self, name, start, end, desc=False, withscores=False, Can't be provided when using ``bylex``. """ + # Need to support ``desc`` also when using old redis version + # because it was supported in 3.5.3 (of redis-py) + if not byscore and not bylex and (offset is None and num is None) \
fix.md
Option A — Apply the official fix\nRestores zrange functionality for older versions of Redis by reverting changes made in a previous pull request.\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\nOption B — Safe version pin\npip install redis==3.5.3\nWhen NOT to use: Do not use if you need features or security fixes in newer releases.\n\n

Why This Fix Works in Production

  • Trigger: 4.0.0rc1 breaks various zrange commands on older servers
  • Mechanism: The zrange command syntax changed to use unsupported options for older Redis servers
Production impact:
  • 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 in real deployments (not just unit tests).
  • The zrange command syntax changed to use unsupported options for older Redis servers
  • Production symptom (often without a traceback): 4.0.0rc1 breaks various zrange commands on older servers

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“@chayim looks like this was broken by #1603.”
@bmerry · 2021-11-07 · source
“Thanks @bmerry for tracking this down all the way. We'll definitely get this into rc2! @AvitalFineRedis while we're here, let's test for this case.”
@chayim · 2021-11-08 · source
“@chayim the following is still broken in 4.0.0rc2 (but worked in 3.5.3):”
@bmerry · 2021-11-09 · source
“@AvitalFineRedis can you add a test with this specific case? Our 6.0.0 testing didn't seem to cover this. @bmerry thanks again, for highlighting this.”
@chayim · 2021-11-09 · source

Failure Signature (Search String)

  • 4.0.0rc1 breaks various zrange commands on older servers
Copy-friendly signature
signature.txt
Failure Signature ----------------- 4.0.0rc1 breaks various zrange commands on older servers @chayim looks like this was broken by #1603.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- 4.0.0rc1 breaks various zrange commands on older servers @chayim looks like this was broken by #1603.

Environment

  • Python: 3.8

What Broke

Older Redis servers return syntax errors when using zrange with new options.

Why It Broke

The zrange command syntax changed to use unsupported options for older Redis servers

Fix Options (Details)

Option A — Apply the official fix

Restores zrange functionality for older versions of Redis by reverting changes made in a previous pull request.

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

Option B — Safe version pin Backward-compatible pin

pip install redis==3.5.3

When NOT to use: Do not use if you need features or security fixes in newer releases.

Use when you can’t upgrade immediately. Plan a follow-up to upgrade (pins can accumulate security/compat debt).

Fix reference: https://github.com/redis/redis-py/pull/1697

Last verified: 2026-02-11. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use if it changes public behavior or if the failure cannot be reproduced.
  • Do not use if you need features or security fixes in newer releases.

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

VersionStatus
3.5.3 Working
4.0.0 Broken

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.