{"record":{"id":"21b9499a7bb98dab","repo":"redis/redis-py","slug":"client-pause-timeout-must-be-an-integer","errorCode":null,"errorMessage":"CLIENT PAUSE timeout must be an integer","messagePattern":"CLIENT PAUSE timeout must be an integer","errorType":"exception","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":1240,"sourceCode":"        For more information, see https://redis.io/commands/client-pause\n\n        Args:\n            timeout: milliseconds to pause clients\n            all: If true (default) all client commands are blocked.\n                 otherwise, clients are only blocked if they attempt to execute\n                 a write command.\n\n        For the WRITE mode, some commands have special behavior:\n\n        * EVAL/EVALSHA: Will block client for all scripts.\n        * PUBLISH: Will block client.\n        * PFCOUNT: Will block client.\n        * WAIT: Acknowledgments will be delayed, so this command will\n            appear blocked.\n        \"\"\"\n        args = [\"CLIENT PAUSE\", str(timeout)]\n        if not isinstance(timeout, int):\n            raise DataError(\"CLIENT PAUSE timeout must be an integer\")\n        if not all:\n            args.append(\"WRITE\")\n        return self.execute_command(*args, **kwargs)\n\n    @overload\n    def client_unpause(self: SyncClientProtocol, **kwargs) -> bytes | str: ...\n\n    @overload\n    def client_unpause(\n        self: AsyncClientProtocol, **kwargs\n    ) -> Awaitable[bytes | str]: ...\n\n    def client_unpause(self, **kwargs) -> (bytes | str) | Awaitable[bytes | str]:\n        \"\"\"\n        Unpause all redis clients\n\n        For more information, see https://redis.io/commands/client-unpause\n        \"\"\"","sourceCodeStart":1222,"sourceCodeEnd":1258,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L1222-L1258","documentation":"Raised by client_pause() (redis/commands/core.py:1240) when timeout is not a Python int (isinstance(timeout, int)). Note bool is a subclass of int so True/False pass through. Floats (e.g. 1.5) and numeric strings ('100') are rejected. This is a redis.exceptions.DataError raised client-side. Note the line ordering: str(timeout) is computed first but the DataError still propagates because raise is hit afterward.","triggerScenarios":"Calling r.client_pause(timeout=1.5) (float), r.client_pause(timeout=\"100\") (string), or a Decimal value. r.client_pause(timeout=100) is fine; r.client_pause(timeout=True) also passes due to bool subclassing int.","commonSituations":"Reading a timeout from an env var or JSON config yields a string; or computing a fractional-second pause; or passing a numpy int that is not a Python int.","solutions":["Pass an int milliseconds value: r.client_pause(timeout=100)","Convert string input: r.client_pause(timeout=int(config_value))","Round floats explicitly: r.client_pause(timeout=int(round(seconds * 1000)))"],"exampleFix":"# before\nr.client_pause(timeout=os.environ[\"PAUSE_MS\"])\n# after\nr.client_pause(timeout=int(os.environ[\"PAUSE_MS\"]))","handlingStrategy":"validation","validationCode":"if not isinstance(timeout, int) or isinstance(timeout, bool) and not isinstance(timeout, int):\n    timeout = int(timeout)\nif not isinstance(timeout, int):\n    raise TypeError(\"timeout must be int\")\nr.client_pause(timeout)","typeGuard":"def is_pause_timeout(v) -> TypeGuard[int]:\n    return isinstance(v, int) and not isinstance(v, bool)","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.client_pause(timeout)\nexcept DataError as e:\n    if \"timeout must be an integer\" in str(e):\n        r.client_pause(int(timeout))\n    else:\n        raise","preventionTips":["Always pass timeout as an int (milliseconds).","Coerce string config values with int(...) at the boundary.","Round fractional seconds explicitly; do not pass floats."],"tags":["client-management","validation","dataerror","type-coercion"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}