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

command_docs is a stub that always raises NotImplementedError. The COMMAND DOCS server command returns documentation in a format not useful to programmatic clients, so redis-py does not wrap it. Use the generic execute_command('COMMAND', 'DOCS', ...) escape hatch if you genuinely need it.

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 da03cdc7e8)

Solutions

  1. Use r.execute_command('COMMAND', 'DOCS', *command_names) if you need the raw server docs.
  2. Consult https://redis.io/commands for human-readable documentation instead.
  3. Use r.command() for structured metadata if docs aren't strictly needed.

Example fix

# before
r.command_docs('SET')
# after
r.execute_command('COMMAND', 'DOCS', 'SET')
Defensive patterns

Strategy: fallback

Try / catch

try:
    r.command_docs('SET')
except NotImplementedError:
    r.execute_command('COMMAND', 'DOCS', 'SET')

Prevention

When it happens

Trigger: Calling r.command_docs('GET'). Auto-generated client wrappers that invoke every command method. Copying redis-cli COMMAND DOCS usage into Python.

Common situations: Building a command-documentation viewer. IDE autocomplete exposes the method but it raises. Expecting structured docs from the server.

Related errors


AI-assisted analysis of redis/redis-py@da03cdc7e8 (2026-08-04). Data as JSON: /data/errors/17889afd054af20d.json. Report an issue: GitHub.