{"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/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/_parsers/commands.py#L291-L327","documentation":"Mirror of error 7 for the response side: raised when a response_policy:<value> tip does not match any ResponsePolicy enum member. Same IncorrectPolicyType exception, same code path in get_command_policies(). Indicates the server advertises an aggregation/response strategy the client does not understand.","triggerScenarios":"A command's tips contain 'response_policy:<unknown>' (e.g. a new aggregation strategy from a newer module); the client tries to coerce it via ResponsePolicy(value) and the ValueError is caught and re-raised as IncorrectPolicyType.","commonSituations":"Version skew between Redis/module and redis-py; experimental module advertising a response policy not yet in the enum; custom fork.","solutions":["Upgrade redis-py to a release whose ResponsePolicy enum covers the value your server advertises.","Inspect tips via 'redis-cli COMMAND INFO <cmd>' and confirm the response_policy string.","Pin or patch the module so its response_policy tip uses a supported value (one_succeeded, all_succeeded, agg_logical_and, agg_logical_or, agg_min, agg_max, agg_sum, special, default_keyless, default_keyed).","File an issue upstream so the enum is extended for the new policy."],"exampleFix":"// before\nrc = RedisCluster(...)\nrc.commands_parser.get_command_policies()  # IncorrectPolicyType: response\n\n// after\n# upgrade redis-py; or on module side restrict tips to supported values","handlingStrategy":"validation","validationCode":"from redis._parsers.commands import ResponsePolicy\nSUPPORTED = {p.value for p in ResponsePolicy}\ndef response_tip_supported(tip):\n    if isinstance(tip, (bytes, str)) and \"response_policy:\" in (tip.decode() if isinstance(tip, bytes) else tip):\n        val = (tip.decode() if isinstance(tip, bytes) else tip).split(\":\")[1]\n        return val in SUPPORTED\n    return True","typeGuard":null,"tryCatchPattern":"try:\n    policies = rc.commands_parser.get_command_policies()\nexcept redis.exceptions.IncorrectPolicyType as e:\n    # unsupported response_policy value; upgrade client or patch module tips\n    raise","preventionTips":["Keep redis-py aligned with the Redis/module version's response_policy vocabulary.","Audit module tips before deploying custom routing.","Patch custom modules to use supported response_policy values.","Pin versions to a known-compatible matrix."],"tags":["cluster","policies","commands","sync"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}