{"id":"34208ddfeb981576","repo":"redis/redis-py","slug":"client-reply-must-be-one-of-replies-r","errorCode":null,"errorMessage":"CLIENT REPLY must be one of {replies!r}","messagePattern":"CLIENT REPLY must be one of (.+?)","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":934,"sourceCode":"        \"\"\"\n        Enable and disable redis server replies.\n\n        ``reply`` Must be ON OFF or SKIP,\n        ON - The default most with server replies to commands\n        OFF - Disable server responses to commands\n        SKIP - Skip the response of the immediately following command.\n\n        Note: When setting OFF or SKIP replies, you will need a client object\n        with a timeout specified in seconds, and will need to catch the\n        TimeoutError.\n        The test_client_reply unit test illustrates this, and\n        conftest.py has a client with a timeout.\n\n        See https://redis.io/commands/client-reply\n        \"\"\"\n        replies = [\"ON\", \"OFF\", \"SKIP\"]\n        if reply not in replies:\n            raise DataError(f\"CLIENT REPLY must be one of {replies!r}\")\n        return self.execute_command(\"CLIENT REPLY\", reply, **kwargs)\n\n    @overload\n    def client_id(self: SyncClientProtocol, **kwargs) -> int: ...\n\n    @overload\n    def client_id(self: AsyncClientProtocol, **kwargs) -> Awaitable[int]: ...\n\n    def client_id(self, **kwargs) -> int | Awaitable[int]:\n        \"\"\"\n        Returns the current connection id\n\n        For more information, see https://redis.io/commands/client-id\n        \"\"\"\n        return self.execute_command(\"CLIENT ID\", **kwargs)\n\n    @overload\n    def client_tracking_on(","sourceCodeStart":916,"sourceCodeEnd":952,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L916-L952","documentation":"Raised by client_reply when the reply argument is not one of 'ON', 'OFF', or 'SKIP'. The check is case-sensitive (exact membership in ['ON','OFF','SKIP']), so lowercase or mixed-case values are rejected.","triggerScenarios":"Calling r.client_reply('on'), r.client_reply('off'), or any non-listed string. Passing an int or object whose value isn't exactly 'ON'/'OFF'/'SKIP'.","commonSituations":"Developer lowercases the constant from a config file. Typing 'skip' lowercase. Passing a boolean instead of the string mode.","solutions":["Pass the exact uppercase constant: 'ON', 'OFF', or 'SKIP'.","Normalize with .upper() if the source may be lowercase: client_reply(mode.upper()).","Remember OFF/SKIP require a client with a timeout and you must catch TimeoutError."],"exampleFix":"# before\nr.client_reply('off')\n# after\nr.client_reply('OFF')","handlingStrategy":"validation","validationCode":"VALID_REPLIES = {'ON', 'OFF', 'SKIP'}\nreply = str(reply).upper()\nif reply not in VALID_REPLIES:\n    raise ValueError(f'Invalid CLIENT REPLY mode: {reply}')","typeGuard":"def is_valid_reply_mode(v: str) -> bool:\n    return isinstance(v, str) and v.upper() in {'ON', 'OFF', 'SKIP'}","tryCatchPattern":null,"preventionTips":["CLIENT REPLY modes are case-sensitive uppercase constants.","When using OFF/SKIP, configure a socket timeout on the client and catch TimeoutError."],"tags":["client-management","validation","dataerror"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}