The Fix
pip install redis==7.1.0
Based on closed redis/redis-py issue #2436 · PR/commit linked
Production note: This tends to surface only under concurrency. Reproduce with load tests and watch for lock contention/cancellation paths.
@@ -38,7 +38,7 @@ def __init__(
fields = {}
- if hascontent:
+ if hascontent and res[i + fields_offset] is not None:
fields = (
Option A — Upgrade to fixed release\npip install redis==7.1.0\nWhen NOT to use: This fix should not be applied if the application relies on the previous behavior of crashing on null results.\n\n
Why This Fix Works in Production
- Trigger: TypeError: 'NoneType' object is not subscriptable on search query
- Mechanism: A race condition occurs when documents are removed while a search query is being performed
- Why the fix works: Fixed a crash that occurs when a key expires while performing a search query. (first fixed release: 7.1.0).
- If left unfixed, failures can be intermittent under concurrency (hard to reproduce; shows up as sporadic 5xx/timeouts).
Why This Breaks in Prod
- A race condition occurs when documents are removed while a search query is being performed
- Surfaces as: TypeError: 'NoneType' object is not subscriptable on search query
Proof / Evidence
- GitHub issue: #2436
- Fix PR: https://github.com/redis/redis-py/pull/2270
- 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.79
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@vampolo Thanks for reporting this! We have already encountered this problem and fixed it here https://github.com/redis/redis-py/pull/2270 The fix is included in version 4.4.0-rc1 which we…”
Failure Signature (Search String)
- TypeError: 'NoneType' object is not subscriptable on search query
Error Message
Stack trace
Error Message
-------------
TypeError: 'NoneType' object is not subscriptable on search query
What Broke
The application crashes with a TypeError when querying a Redis search index.
Why It Broke
A race condition occurs when documents are removed while a search query is being performed
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/2270
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 applied if the application relies on the previous behavior of crashing on null results.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a stress test that runs high-concurrency workloads and fails on thread dumps / blocked locks.
- Enable watchdog dumps in prod (faulthandler, thread dump endpoint) to capture deadlocks quickly.
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.