redis/redis-py · error · NotImplementedError
MEMORY DOCTOR is intentionally not implemented in the…
Error message
MEMORY DOCTOR is intentionally not implemented in the client. For more information, see https://redis.io/commands/memory-doctor
What it means
Raised by memory_doctor() (redis/commands/core.py:1868) which is a stub that unconditionally raises NotImplementedError. MEMORY DOCTOR emits a human-readable advisory report designed for redis-cli, so the python client does not implement it. Structured memory commands that ARE supported: memory_stats, memory_usage, memory_malloc_stats, memory_purge. No arguments are accepted.
Solutions
- Use r.memory_stats() for a structured dict and r.memory_usage(key) for per-key sizing
- Run 'redis-cli MEMORY DOCTOR' for the human-readable advisory
- If required from python: r.execute_command("MEMORY", "DOCTOR")
Example fix
# before r.memory_doctor() # after stats = r.memory_stats()
Defensive patterns
Strategy: fallback
Validate before calling
# memory_doctor() is intentionally unimplemented; use structured APIs
def memory_summary(r):
return r.memory_stats() Try / catch
try:
r.memory_doctor()
except NotImplementedError:
stats = r.memory_stats() Prevention
- Use memory_stats()/memory_usage() for programmatic data.
- Reserve MEMORY DOCTOR for redis-cli.
- Mark memory_doctor() as unavailable in internal docs.
When it happens
Trigger: Calling r.memory_doctor(). Any call raises immediately.
Common situations: Building a memory diagnostics dashboard and reaching for the 'doctor' summary; assuming the MEMORY subcommands are fully mirrored.
Related errors
- MEMORY HELP is intentionally not implemented in the client…
- 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…
- FAILOVER is intentionally not implemented in the client.
AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10).
Data as JSON: /api/errors/76fbd87ce1e2dbf8.
Report an issue: GitHub.
Appendix: source
Thrown at redis/commands/core.py:1868
@overload
def object(self: SyncClientProtocol, infotype: str, key: KeyT, **kwargs) -> Any: ...
@overload
def object(
self: AsyncClientProtocol, infotype: str, key: KeyT, **kwargs
) -> Awaitable[Any]: ...
def object(self, infotype: str, key: KeyT, **kwargs) -> Any | Awaitable[Any]:
"""
Return the encoding, idletime, or refcount about the key
"""
return self.execute_command(
"OBJECT", infotype, key, infotype=infotype, **kwargs
)
def memory_doctor(self, **kwargs) -> None:
raise NotImplementedError(
"""
MEMORY DOCTOR is intentionally not implemented in the client.
For more information, see https://redis.io/commands/memory-doctor
"""
)
def memory_help(self, **kwargs) -> None:
raise NotImplementedError(
"""
MEMORY HELP is intentionally not implemented in the client.
For more information, see https://redis.io/commands/memory-help
"""
)
@overload
def memory_stats(self: SyncClientProtocol, **kwargs) -> dict[str, Any]: ...View on GitHub (pinned to 6a6b581b48)