The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2600 · PR/commit linked
Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.
@@ -44,7 +44,7 @@
)
from .helpers import list_or_args
-from .redismodules import RedisModuleCommands
+from .redismodules import AsyncRedisModuleCommands, RedisModuleCommands
import asyncio
from redis.asyncio.cluster import RedisCluster # type: ignore
import redis.asyncio as redis # type: ignore
async def main():
r = RedisCluster.from_url("redis://localhost:16379/0")
p = r.pipeline()
p.json().set("blah", ".", 1)
await p.execute()
print("done")
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
asyncio.get_event_loop().run_until_complete(main())
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: This fix should not be used if the application relies on older Redis versions without JSON support.\n\n
Why This Fix Works in Production
- Trigger: raises `AttributeError: 'RedisCluster' object has no attribute 'json'`
- Mechanism: The RedisCluster object did not have the json attribute implemented for async commands
- Why the fix works: Adds support for JSON commands in Async Cluster, addressing the issue where the RedisCluster object lacked the json attribute. (first fixed release: 7.1.0).
- If left unfixed, retries/timeouts can trigger duplicate external side-effects (double charges, duplicate emails, repeated writes).
Why This Breaks in Prod
- Shows up under Python 3.11 in real deployments (not just unit tests).
- The RedisCluster object did not have the json attribute implemented for async commands
- Production symptom (often without a traceback): raises `AttributeError: 'RedisCluster' object has no attribute 'json'`
Proof / Evidence
- GitHub issue: #2600
- Fix PR: https://github.com/redis/redis-py/pull/3115
- 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.65
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Hi, This issue does not seem fully resolved, this code still crashes: I hacked up some changes that seem to make this pass, but it's…”
Failure Signature (Search String)
- raises `AttributeError: 'RedisCluster' object has no attribute 'json'`
- Actually, it's a duplicate of #2234 which was closed without real solution
Copy-friendly signature
Failure Signature
-----------------
raises `AttributeError: 'RedisCluster' object has no attribute 'json'`
Actually, it's a duplicate of #2234 which was closed without real solution
Error Message
Signature-only (no traceback captured)
Error Message
-------------
raises `AttributeError: 'RedisCluster' object has no attribute 'json'`
Actually, it's a duplicate of #2234 which was closed without real solution
Minimal Reproduction
import asyncio
from redis.asyncio.cluster import RedisCluster # type: ignore
import redis.asyncio as redis # type: ignore
async def main():
r = RedisCluster.from_url("redis://localhost:16379/0")
p = r.pipeline()
p.json().set("blah", ".", 1)
await p.execute()
print("done")
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
asyncio.get_event_loop().run_until_complete(main())
Environment
- Python: 3.11
What Broke
Attempting to use JSON commands resulted in an AttributeError, causing application crashes.
Why It Broke
The RedisCluster object did not have the json attribute implemented for async commands
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.
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.
- This is most useful when retries/timeouts can re-trigger the same external call.
Show example snippet (optional)
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)
Fix reference: https://github.com/redis/redis-py/pull/3115
First fixed release: 7.1.0
Last verified: 2026-02-07. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the application relies on older Redis versions without JSON support.
- 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
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.