{"record":{"id":"6111fe1e97b49db4","repo":"redis/redis-py","slug":"incorrect-response-policy-type-policy-type","errorCode":null,"errorMessage":"Incorrect response policy type: {policy_type}","messagePattern":"Incorrect response policy type: (.+?)","errorType":"exception","errorClass":"IncorrectPolicyType","httpStatus":null,"severity":"error","filePath":"redis/_parsers/commands.py","lineNumber":309,"sourceCode":"\n                        try:\n                            command_with_policies[module_name][\n                                command_name\n                            ].request_policy = RequestPolicy(policy_type)\n                        except ValueError:\n                            raise IncorrectPolicyType(\n                                f\"Incorrect request policy type: {policy_type}\"\n                            )\n\n                    if policy.startswith(\"response_policy\"):\n                        policy_type = policy.split(\":\")[1]\n\n                        try:\n                            command_with_policies[module_name][\n                                command_name\n                            ].response_policy = ResponsePolicy(policy_type)\n                        except ValueError:\n                            raise IncorrectPolicyType(\n                                f\"Incorrect response policy type: {policy_type}\"\n                            )\n\n            elif isinstance(data, list):\n                # For lists, recursively process each element\n                for item in data:\n                    extract_policies(item, module_name, command_name)\n\n            elif isinstance(data, dict):\n                # For dictionaries, recursively process each value\n                for value in data.values():\n                    extract_policies(value, module_name, command_name)\n\n        for command, details in self.commands.items():\n            # Check whether the command has keys\n            is_keyless = self._is_keyless_command(command)\n\n            if is_keyless:","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/_parsers/commands.py#L291-L327","documentation":"Raised by the sync CommandsParser.get_command_policies().extract_policies() (redis/_parsers/commands.py:309) when a 'response_policy:<value>' tip string from COMMAND output cannot be mapped to a ResponsePolicy enum member (ResponsePolicy(policy_type) raises ValueError). It surfaces as IncorrectPolicyType, meaning the server advertised a response-aggregation policy the client does not recognize.","triggerScenarios":"A Redis server or module publishes a command tip like 'response_policy:<x>' where <x> is not among ResponsePolicy values (one_succeeded, all_succeeded, agg_logical_and, agg_logical_or, agg_min, agg_max, agg_sum, special, default_keyless, default_keyed). Usually a newer server/module than the client.","commonSituations":"Version skew between a newer Redis/module and an older redis-py; a custom module declaring an unsupported response_policy tip.","solutions":["Upgrade redis-py to a release whose ResponsePolicy enum includes the advertised value.","Align the server/module version with what this client supports.","For a custom module, use a standard ResponsePolicy tip value.","File an upstream issue with the exact tip string from COMMAND INFO."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Verify the server-advertised response_policy tip is a known enum value\nfrom redis._parsers.commands import ResponsePolicy\nvalid = {m.value for m in ResponsePolicy}\nif policy_value not in valid:\n    raise ValueError(f\"unsupported response_policy: {policy_value}; upgrade redis-py\")","typeGuard":null,"tryCatchPattern":"from redis.exceptions import IncorrectPolicyType\ntry:\n    policies = parser.get_command_policies()\nexcept IncorrectPolicyType as e:\n    # version skew: newer server advertised an unknown response_policy\n    # -> upgrade redis-py or align server version\n    ...","preventionTips":["Keep redis-py and the Redis server/module versions aligned.","For custom modules, emit only standard ResponsePolicy tip values.","Pin server versions in mixed clusters to avoid advertising unknown policies."],"tags":["cluster","policies","version-skew","module"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}