redis/redis-py · error · RedisClusterException

method eval() is not implemented

Error message

method eval() is not implemented

What it means

Raised as a RedisClusterException by the eval() method on the abstract PipelineCommandExecutionStrategy base class (cluster.py:4116-4118). The base execution strategy does not implement eval/load_scripts/script_load_for_pipeline because cluster pipelines handle Lua script loading differently (via the concrete execution strategy subclasses). Calling eval() on a pipeline whose execution strategy is the abstract base indicates a misconfigured or partially-constructed pipeline object.

Solutions

  1. Do not call eval() through the cluster pipeline; register scripts on the client first with client.script_load(script), then use pipe.evalsha(sha1, numkeys, *keys) in the pipeline.
  2. Run EVAL/EVALSHA directly on the client (not the pipeline) if you need scripting outside the pipeline abstraction.
  3. Ensure you are using the standard ClusterPipeline from client.pipeline() so the concrete execution strategy is wired up.

Example fix

// before
pipe = client.pipeline()
pipe.eval('return 1', 0)

// after
sha = client.script_load('return 1')
pipe.evalsha(sha, 0)
Defensive patterns

Strategy: validation

Validate before calling

# Pre-load scripts and use evalsha in the pipeline instead of eval
sha = client.script_load('return 1')
pipe = client.pipeline()
pipe.evalsha(sha, 0)
results = pipe.execute()

Type guard

def is_eval_on_pipeline(method_name: str) -> bool:
    return method_name in ('eval', 'load_scripts', 'script_load_for_pipeline')

Try / catch

from redis.exceptions import RedisClusterException
try:
    pipe.eval('return 1', 0)
except RedisClusterException as e:
    if 'not implemented' in str(e):
        sha = client.script_load('return 1')
        pipe.evalsha(sha, 0)

Prevention

When it happens

Trigger: Calling pipe.eval() or pipe.load_scripts() on a ClusterPipeline whose _execution_strategy is the abstract base class rather than a concrete subclass. Also raised by load_scripts() and script_load_for_pipeline() on the same base.

Common situations: Attempting to use Lua scripting through the pipeline API in a way that reaches the abstract base, or a subclass was not properly selected during pipeline construction.

Related errors


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

Appendix: source

Thrown at redis/cluster.py:4118

    def execute(self, raise_on_error: bool = True) -> List[Any]:
        pass

    @abstractmethod
    def send_cluster_commands(
        self, stack, raise_on_error=True, allow_redirections=True
    ):
        pass

    @abstractmethod
    def reset(self):
        pass

    def exists(self, *keys):
        return self.execute_command("EXISTS", *keys)

    def eval(self):
        """ """
        raise RedisClusterException("method eval() is not implemented")

    def load_scripts(self):
        """ """
        raise RedisClusterException("method load_scripts() is not implemented")

    def script_load_for_pipeline(self, *args, **kwargs):
        """ """
        raise RedisClusterException(
            "method script_load_for_pipeline() is not implemented"
        )

    def annotate_exception(self, exception, number, command):
        """
        Provides extra context to the exception prior to it being handled
        """
        cmd = " ".join(map(safe_str, command))
        msg = (
            f"Command # {number} ({truncate_text(cmd)}) of pipeline "

View on GitHub (pinned to 6a6b581b48)