Jump to solution
Verify

The Fix

pip install redis==7.1.0

Based on closed redis/redis-py issue #2839 · 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
@@ -194,7 +194,7 @@ def _get_args_tags(self): if self._slop >= 0: args += ["SLOP", self._slop] - if self._timeout: + if self._timeout is not None: args += ["TIMEOUT", self._timeout]
repro.py
q = ( Query( f"{prefilter_condition}=>[KNN $K @vector $vec_param EF_RUNTIME $EF AS vector_score]" ) .sort_by("vector_score", asc=False) .paging(0, top) .return_fields("vector_score") .dialect(2) .timeout(0) )
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 should not be used if the timeout parameter is expected to be a positive integer.\n\n

Why This Fix Works in Production

  • Trigger: query object is not outputing the `TIMEOUT` argument in case of 0 ( 0 means unlimited for RediSearch TIMEOUT parameter )
  • Mechanism: The timeout parameter of 0 was incorrectly interpreted as False, preventing its inclusion in the query arguments
  • Why the fix works: Supports the timeout parameter set to 0 in RediSearch queries, allowing unlimited execution time. (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

  • The timeout parameter of 0 was incorrectly interpreted as False, preventing its inclusion in the query arguments
  • Production symptom (often without a traceback): query object is not outputing the `TIMEOUT` argument in case of 0 ( 0 means unlimited for RediSearch TIMEOUT parameter )

Proof / Evidence

  • GitHub issue: #2839
  • Fix PR: https://github.com/redis/redis-py/pull/2934
  • 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.65

Discussion

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

“To be fixed by https://github.com/redis/redis-py/pull/2934”
@filipecosta90 · 2023-09-12 · source

Failure Signature (Search String)

  • query object is not outputing the `TIMEOUT` argument in case of 0 ( 0 means unlimited for RediSearch TIMEOUT parameter )
  • **Version**: 4.6.0 or any above 4.4.1 given the timeout parameter was introduced there (https://github.com/redis/redis-py/releases/tag/v4.4.1)
Copy-friendly signature
signature.txt
Failure Signature ----------------- query object is not outputing the `TIMEOUT` argument in case of 0 ( 0 means unlimited for RediSearch TIMEOUT parameter ) **Version**: 4.6.0 or any above 4.4.1 given the timeout parameter was introduced there (https://github.com/redis/redis-py/releases/tag/v4.4.1)

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- query object is not outputing the `TIMEOUT` argument in case of 0 ( 0 means unlimited for RediSearch TIMEOUT parameter ) **Version**: 4.6.0 or any above 4.4.1 given the timeout parameter was introduced there (https://github.com/redis/redis-py/releases/tag/v4.4.1)

Minimal Reproduction

repro.py
q = ( Query( f"{prefilter_condition}=>[KNN $K @vector $vec_param EF_RUNTIME $EF AS vector_score]" ) .sort_by("vector_score", asc=False) .paging(0, top) .return_fields("vector_score") .dialect(2) .timeout(0) )

What Broke

Queries with a timeout of 0 did not include the TIMEOUT argument, leading to unexpected behavior in RediSearch.

Why It Broke

The timeout parameter of 0 was incorrectly interpreted as False, preventing its inclusion in the query 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 should not be used if the timeout parameter is expected to be a positive integer.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Option D — Guard side-effects with OnceOnly Guardrail for side-effects

Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.

  • Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
  • Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
  • Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
onceonly.py
from onceonly import OnceOnly import os once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True) # Stable idempotency key per real side-effect. # Use a request id / job id / webhook delivery id / Stripe event id, etc. event_id = "evt_..." # replace key = f"stripe:webhook:{event_id}" res = once.check_lock(key=key, ttl=3600) if res.duplicate: return {"status": "already_processed"} # Safe to execute the side-effect exactly once. handle_event(event_id)

See OnceOnly SDK

When NOT to use: Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

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

First fixed release: 7.1.0

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

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if the timeout parameter is expected to be a positive integer.
  • Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

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

  • Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
  • Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.

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.