redis/redis-py · error · NotImplementedError

EXPLAINCLI will not be implemented.

Error message

EXPLAINCLI will not be implemented.

What it means

Raised by explain_cli() (redis/commands/search/commands.py:1423) as NotImplementedError - the method exists for API compatibility but is deliberately not implemented. There is no FT.EXPLAINCLI surface exposed by this client; use explain() (FT.EXPLAIN) instead.

Solutions

  1. Use index.explain(query) which issues FT.EXPLAIN and returns the plan.
  2. Remove any explain_cli calls from your code; the method will never succeed.
  3. If you need CLI-style output, format the result of explain() yourself.

Example fix

# before
plan = index.explain_cli(query)
# after
plan = index.explain(query)
Defensive patterns

Strategy: fallback

Validate before calling

def safe_explain(index, query):
    return index.explain(query)  # never call explain_cli

Type guard

null

Try / catch

try:
    plan = index.explain_cli(query)
except NotImplementedError:
    plan = index.explain(query)

Prevention

When it happens

Trigger: Calling index.explain_cli(query). Any direct call to this method raises unconditionally.

Common situations: Migrating from an older client or another library that exposed EXPLAINCLI, or assuming parity with the redis-cli EXPLAINCLI command.

Related errors


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

Appendix: source

Thrown at redis/commands/search/commands.py:1423

        if isinstance(res, Pipeline):
            return res

        return self._parse_results(HYBRID_CMD, res, **options)

    def explain(
        self,
        query: Union[str, Query],
        query_params: Optional[Dict[str, Union[str, int, float, bytes]]] = None,
    ):
        """Returns the execution plan for a complex query.

        For more information see `FT.EXPLAIN <https://redis.io/commands/ft.explain>`_.
        """  # noqa
        args, query_text = self._mk_query_args(query, query_params=query_params)
        return self.execute_command(EXPLAIN_CMD, *args)

    def explain_cli(self, query: Union[str, Query]):  # noqa
        raise NotImplementedError("EXPLAINCLI will not be implemented.")

    def aggregate(
        self,
        query: Union[AggregateRequest, Cursor],
        query_params: Optional[Dict[str, Union[str, int, float, bytes]]] = None,
    ):
        """
        Issue an aggregation query.

        ### Parameters

        **query**: This can be either an `AggregateRequest`, or a `Cursor`

        An `AggregateResult` object is returned. You can access the rows from
        its `rows` property, which will always yield the rows of the result.

        For more information see `FT.AGGREGATE <https://redis.io/commands/ft.aggregate>`_.
        """  # noqa

View on GitHub (pinned to 6a6b581b48)