redis/redis-py · error · NotImplementedError
LATENCY DOCTOR is intentionally not implemented in the…
Error message
LATENCY DOCTOR is intentionally not implemented in the client. For more information, see https://redis.io/commands/latency-doctor
What it means
Raised by latency_doctor() (redis/commands/core.py:1717) which is a stub that unconditionally raises NotImplementedError. LATENCY DOCTOR returns a human-readable narrative report intended for the redis-cli, so the python client does not implement it. Related latency commands that ARE supported: latency_history, latency_latest, latency_reset. No arguments are accepted.
Solutions
- Use the structured equivalents: r.latency_latest() and r.latency_history(event) for machine-readable data
- Run 'redis-cli LATENCY DOCTOR' for the human-readable narrative
- If you must call it from python: r.execute_command("LATENCY", "DOCTOR")
Example fix
# before r.latency_doctor() # after import pprint; pprint.pprint(r.latency_latest())
Defensive patterns
Strategy: fallback
Validate before calling
# latency_doctor() is intentionally unimplemented; use structured APIs
def latency_summary(r):
return r.latency_latest() Try / catch
try:
r.latency_doctor()
except NotImplementedError:
latest = r.latency_latest() Prevention
- Use latency_latest()/latency_history() for structured data.
- Reserve LATENCY DOCTOR for redis-cli.
- Document in your codebase that this method is a permanent stub.
When it happens
Trigger: Calling r.latency_doctor(). Any call raises immediately.
Common situations: Programmatic latency analysis where the developer reaches for a 'doctor' summary instead of the structured history/latest data.
Related errors
- LATENCY GRAPH is intentionally not implemented in the…
- LATENCY HISTOGRAM is intentionally not implemented in the…
- COMMAND DOCS is intentionally not implemented in the client.
- COMMAND INFO is intentionally not implemented in the client.
- DEBUG SEGFAULT is intentionally not implemented in the…
AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10).
Data as JSON: /api/errors/7aafa1c0c2dc567b.
Report an issue: GitHub.
Appendix: source
Thrown at redis/commands/core.py:1717
self: AsyncClientProtocol, **kwargs
) -> Awaitable[datetime.datetime]: ...
def lastsave(self, **kwargs) -> datetime.datetime | Awaitable[datetime.datetime]:
"""
Return a Python datetime object representing the last time the
Redis database was saved to disk
For more information, see https://redis.io/commands/lastsave
"""
return self.execute_command("LASTSAVE", **kwargs)
def latency_doctor(self):
"""Raise a NotImplementedError, as the client will not support LATENCY DOCTOR.
This function is best used within the redis-cli.
For more information, see https://redis.io/commands/latency-doctor
"""
raise NotImplementedError(
"""
LATENCY DOCTOR is intentionally not implemented in the client.
For more information, see https://redis.io/commands/latency-doctor
"""
)
def latency_graph(self):
"""Raise a NotImplementedError, as the client will not support LATENCY GRAPH.
This function is best used within the redis-cli.
For more information, see https://redis.io/commands/latency-graph.
"""
raise NotImplementedError(
"""
LATENCY GRAPH is intentionally not implemented in the client.
For more information, see https://redis.io/commands/latency-graphView on GitHub (pinned to 6a6b581b48)