The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2383 · 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%.
@@ -104,7 +104,6 @@ def __init__(self, query="*"):
self._loadfields = []
self._loadall = False
- self._limit = Limit()
self._max = 0
self._with_schema = False
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: Do not use this fix if the application relies on the previous limit behavior for aggregation.\n\n
Why This Fix Works in Production
- Trigger: [Bug] Aggregation Request Generates Incorrect Command Arguments for LIMIT
- Mechanism: The AggregateRequest class incorrectly overwrites previous limit settings when applying new limits
- Why the fix works: Fixes the aggregation request arguments for LIMIT in redis-py, ensuring that multiple limits can be applied correctly during aggregation. (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 in real deployments (not just unit tests).
- The AggregateRequest class incorrectly overwrites previous limit settings when applying new limits
- Production symptom (often without a traceback): [Bug] Aggregation Request Generates Incorrect Command Arguments for LIMIT
Proof / Evidence
- GitHub issue: #2383
- Fix PR: https://github.com/redis/redis-py/pull/2393
- 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.73
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@dvora-h looks like a good candidate for 4.4.0 bug fix”
Failure Signature (Search String)
- [Bug] Aggregation Request Generates Incorrect Command Arguments for LIMIT
- This happens because `AggregateRequest` generates an incorrect list of arguments for LIMIT. Given the above query, you would expect the following arguments to be generated:
Copy-friendly signature
Failure Signature
-----------------
[Bug] Aggregation Request Generates Incorrect Command Arguments for LIMIT
This happens because `AggregateRequest` generates an incorrect list of arguments for LIMIT. Given the above query, you would expect the following arguments to be generated:
Error Message
Signature-only (no traceback captured)
Error Message
-------------
[Bug] Aggregation Request Generates Incorrect Command Arguments for LIMIT
This happens because `AggregateRequest` generates an incorrect list of arguments for LIMIT. Given the above query, you would expect the following arguments to be generated:
Environment
- Python: 3.8
What Broke
Aggregation requests return more results than expected, leading to incorrect data processing.
Why It Broke
The AggregateRequest class incorrectly overwrites previous limit settings when applying new limits
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/2393
First fixed release: 7.1.0
Last verified: 2026-02-07. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the application relies on the previous limit behavior for aggregation.
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.