redis/redis-py · error · NotImplementedError

COMMAND DOCS is intentionally not implemented in the client.

Error message

COMMAND DOCS is intentionally not implemented in the client.

What it means

Raised by command_docs() (redis/commands/core.py:1397) which is a stub that unconditionally raises NotImplementedError. COMMAND DOCS returns documentation blobs designed for CLI/GUI tooling, not for client use, so the library intentionally refuses it. No arguments are accepted.

Solutions

  1. Send it directly if truly needed: r.execute_command("COMMAND", "DOCS", "GET")
  2. Use r.command() / r.command_list() for metadata the client does support
  3. Prefer the published Redis docs at https://redis.io/commands for human-readable help

Example fix

# before
r.command_docs("GET")
# after
r.execute_command("COMMAND", "DOCS", "GET")
Defensive patterns

Strategy: fallback

Validate before calling

# command_docs() is intentionally unimplemented; route to execute_command
def command_docs(r, *names):
    return r.execute_command("COMMAND", "DOCS", *names)

Try / catch

try:
    r.command_docs()
except NotImplementedError:
    docs = r.execute_command("COMMAND", "DOCS")

Prevention

When it happens

Trigger: Calling r.command_docs() or r.command_docs("GET"). Any call raises immediately.

Common situations: Trying to build auto-documentation or help text from the server; assuming the python client exposes every COMMAND subcommand.

Related errors


AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10). Data as JSON: /api/errors/17889afd054af20d. Report an issue: GitHub.

Appendix: source

Thrown at redis/commands/core.py:1397

        self: AsyncClientProtocol, *args: str
    ) -> Awaitable[CommandGetKeysAndFlagsResponse]: ...

    def command_getkeysandflags(
        self, *args: str
    ) -> CommandGetKeysAndFlagsResponse | Awaitable[CommandGetKeysAndFlagsResponse]:
        """
        Returns array of keys from a full Redis command and their usage flags.

        For more information, see https://redis.io/commands/command-getkeysandflags
        """
        return self.execute_command("COMMAND GETKEYSANDFLAGS", *args)

    def command_docs(self, *args):
        """
        This function throws a NotImplementedError since it is intentionally
        not supported.
        """
        raise NotImplementedError(
            "COMMAND DOCS is intentionally not implemented in the client."
        )

    @overload
    def config_get(
        self: SyncClientProtocol, pattern: PatternT = "*", *args: PatternT, **kwargs
    ) -> dict[str | None, str | None]: ...

    @overload
    def config_get(
        self: AsyncClientProtocol, pattern: PatternT = "*", *args: PatternT, **kwargs
    ) -> Awaitable[dict[str | None, str | None]]: ...

    def config_get(
        self, pattern: PatternT = "*", *args: PatternT, **kwargs
    ) -> dict[str | None, str | None] | Awaitable[dict[str | None, str | None]]:
        """
        Return a dictionary of configuration based on the ``pattern``

View on GitHub (pinned to 6a6b581b48)