{"record":{"id":"5b61482f4f23bff1","repo":"redis/redis-py","slug":"method-script-load-for-pipeline-is-not-implement","errorCode":null,"errorMessage":"method script_load_for_pipeline() is not implemented","messagePattern":"method script_load_for_pipeline\\(\\) is not implemented","errorType":"exception","errorClass":"RedisClusterException","httpStatus":null,"severity":"error","filePath":"redis/cluster.py","lineNumber":4126,"sourceCode":"\n    @abstractmethod\n    def reset(self):\n        pass\n\n    def exists(self, *keys):\n        return self.execute_command(\"EXISTS\", *keys)\n\n    def eval(self):\n        \"\"\" \"\"\"\n        raise RedisClusterException(\"method eval() is not implemented\")\n\n    def load_scripts(self):\n        \"\"\" \"\"\"\n        raise RedisClusterException(\"method load_scripts() is not implemented\")\n\n    def script_load_for_pipeline(self, *args, **kwargs):\n        \"\"\" \"\"\"\n        raise RedisClusterException(\n            \"method script_load_for_pipeline() is not implemented\"\n        )\n\n    def annotate_exception(self, exception, number, command):\n        \"\"\"\n        Provides extra context to the exception prior to it being handled\n        \"\"\"\n        cmd = \" \".join(map(safe_str, command))\n        msg = (\n            f\"Command # {number} ({truncate_text(cmd)}) of pipeline \"\n            f\"caused error: {exception.args[0]}\"\n        )\n        exception.args = (msg,) + exception.args[1:]\n\n\nclass PipelineStrategy(AbstractStrategy):\n    def __init__(self, pipe: ClusterPipeline):\n        super().__init__(pipe)","sourceCodeStart":4108,"sourceCodeEnd":4144,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/cluster.py#L4108-L4144","documentation":"Raised by AbstractStrategy.script_load_for_pipeline() in redis/cluster.py:4126. This standalone-pipeline helper loads a Lua script and rewrites pipeline EVAL calls to EVALSHA for wire efficiency; it has no cluster implementation because scripts must be sharded across nodes and the cluster pipeline does not rewrite commands that way. Calling it directly on a cluster pipeline is unsupported.","triggerScenarios":"Invoking pipe.script_load_for_pipeline(script) (or rc.script_load_for_pipeline(...)) on a RedisCluster or ClusterPipeline object, typically copied from standalone redis.Redis pipeline code.","commonSituations":"Migrating a standalone Redis pipeline optimization pattern to cluster mode; generic pipeline wrapper code that calls script_load_for_pipeline on every client type.","solutions":["Drop the script_load_for_pipeline() call; the cluster pipeline routes EVAL/EVALSHA per-slot automatically.","Pre-load the script on all primaries manually with rc.cluster_execute_command('SCRIPT LOAD', script, target_nodes='primaries') if you want EVALSHA availability.","Use a non-cluster client if the standalone optimization is required."],"exampleFix":"// before\npipe = rc.pipeline()\npipe.script_load_for_pipeline(script)\n// after\npipe = rc.pipeline()\npipe.eval(script, numkeys, *keys)  # cluster handles routing","handlingStrategy":"validation","validationCode":"from redis.cluster import RedisCluster\nif not isinstance(rc, RedisCluster):\n    pipe.script_load_for_pipeline(script)","typeGuard":"def supports_script_load_for_pipeline(client) -> bool:\n    from redis.cluster import RedisCluster\n    return not isinstance(client, RedisCluster)","tryCatchPattern":"from redis.exceptions import RedisClusterException\ntry:\n    pipe.script_load_for_pipeline(script)\nexcept RedisClusterException:\n    pass","preventionTips":["Do not call standalone pipeline helpers on cluster pipelines.","Let EVAL/EVALSHA handle script loading in cluster mode."],"tags":["cluster","pipeline","lua-scripting","api-misuse"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}