Jump to solution
Verify

The Fix

pip install redis==7.1.0

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

Jump to Verify Open PR/Commit
@@ -5581,7 +5581,7 @@ def _geosearchgeneric( ) pieces.extend([b"FROMMEMBER", kwargs["member"]]) - if kwargs["longitude"] and kwargs["latitude"]: + if kwargs["longitude"] is not None and kwargs["latitude"] is not None: pieces.extend([b"FROMLONLAT", kwargs["longitude"], kwargs["latitude"]])
repro.py
def main(): redis = Redis.from_url(url="redis://localhost:6379") key = "theindex" lon: float = 0.0 lat: float = 1.0 redis.geoadd(name=key, values=[lon, lat, "foo"]) results = redis.geosearch(name=key, longitude=lon, latitude=lat, radius=1, unit="km") print(results)
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: This fix is not applicable if the geosearch command is used with non-numeric types for longitude or latitude.\n\n

Why This Fix Works in Production

  • Trigger: poetry run python playground/bug/main.py
  • Mechanism: Fixes the issue where passing 0.0 longitude or latitude to the geosearch command resulted in an error.
  • Why the fix works: Fixes the issue where passing 0.0 longitude or latitude to the geosearch command resulted in an error. (first fixed release: 7.1.0).
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.9.15 in real deployments (not just unit tests).
  • Surfaces as: poetry run python playground/bug/main.py

Proof / Evidence

  • GitHub issue: #2462
  • Fix PR: https://github.com/redis/redis-py/pull/2464
  • First fixed release: 7.1.0
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-07
  • Confidence: 0.95
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.36

Discussion

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

“The issue gets fixed if lat and lon are passed as strings. This will work:”
@petru-motrescu · 2022-11-18 · source
“@shacharPash you mentioned being interested in a lightweight PR... I think this could be a decent entrypoint.”
@chayim · 2022-11-29 · source

Failure Signature (Search String)

  • poetry run python playground/bug/main.py

Error Message

Stack trace
error.txt
Error Message ------------- poetry run python playground/bug/main.py Traceback (most recent call last): File "/Users/petru/PLAY/redis-playground/playground/bug/main.py", line 22, in <module> main() File "/Users/petru/PLAY/redis-playground/playground/bug/main.py", line 18, in main results = redis.geosearch(name=key, longitude=lon, latitude=lat, radius=1, unit="km") File "/.../python3.9/site-packages/redis/commands/core.py", line 5474, in geosearch return self._geosearchgeneric( File "/.../python3.9/site-packages/redis/commands/core.py", line 5605, in _geosearchgeneric return self.execute_command(command, *pieces, **kwargs) File "/.../python3.9/site-packages/redis/client.py", line 1238, in execute_command return conn.retry.call_with_retry( File "/.../python3.9/site-packages/redis/retry.py", line 46, in call_with_retry return do() File "/.../python3.9/site-packages/redis/client.py", line 1239, in <lambda> lambda: self._send_command_parse_response( File "/.../python3.9/site-packages/redis/client.py", line 1215, in _send_command_parse_response return self.parse_response(conn, command_name, **options) File "/.../python3.9/site-packages/redis/client.py", line 1254, in parse_response response = connection.read_response() File "/.../python3.9/site-packages/redis/connection.py", line 839, in read_response raise response redis.exceptions.ResponseError: wron ... (truncated) ...

Minimal Reproduction

repro.py
def main(): redis = Redis.from_url(url="redis://localhost:6379") key = "theindex" lon: float = 0.0 lat: float = 1.0 redis.geoadd(name=key, values=[lon, lat, "foo"]) results = redis.geosearch(name=key, longitude=lon, latitude=lat, radius=1, unit="km") print(results)

Environment

  • Python: 3.9.15

What Broke

The application raises a ResponseError when executing the geosearch command with invalid arguments.

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install redis==7.1.0

When NOT to use: This fix is not applicable if the geosearch command is used with non-numeric types for longitude or latitude.

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/2464

First fixed release: 7.1.0

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

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix is not applicable if the geosearch command is used with non-numeric types for longitude or latitude.

Verify Fix

verify
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

VersionStatus
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.