{"id":"f7d0859815fd01a9","repo":"redis/redis-py","slug":"client-kill-skipme-must-be-a-bool","errorCode":null,"errorMessage":"CLIENT KILL skipme must be a bool","messagePattern":"CLIENT KILL skipme must be a bool","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":782,"sourceCode":"        :param _type: Kills a client by type where type is one of 'normal',\n        'master', 'slave', 'replica' or 'pubsub'\n        :param addr: Kills a client by its 'address:port'\n        :param skipme: If True, then the client calling the command\n        will not get killed even if it is identified by one of the filter\n        options. If skipme is not provided, the server defaults to skipme=True\n        :param laddr: Kills a client by its 'local (bind) address:port'\n        :param user: Kills a client for a specific user name\n        :param maxage: Kills clients that are older than the specified age in seconds\n        \"\"\"\n        args = []\n        if _type is not None:\n            client_types = (\"normal\", \"master\", \"slave\", \"replica\", \"pubsub\")\n            if str(_type).lower() not in client_types:\n                raise DataError(f\"CLIENT KILL type must be one of {client_types!r}\")\n            args.extend((b\"TYPE\", _type))\n        if skipme is not None:\n            if not isinstance(skipme, bool):\n                raise DataError(\"CLIENT KILL skipme must be a bool\")\n            if skipme:\n                args.extend((b\"SKIPME\", b\"YES\"))\n            else:\n                args.extend((b\"SKIPME\", b\"NO\"))\n        if _id is not None:\n            args.extend((b\"ID\", _id))\n        if addr is not None:\n            args.extend((b\"ADDR\", addr))\n        if laddr is not None:\n            args.extend((b\"LADDR\", laddr))\n        if user is not None:\n            args.extend((b\"USER\", user))\n        if maxage is not None:\n            args.extend((b\"MAXAGE\", maxage))\n        if not args:\n            raise DataError(\n                \"CLIENT KILL <filter> <value> ... ... <filter> \"\n                \"<value> must specify at least one filter\"","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L764-L800","documentation":"Raised by client_kill when the skipme argument is not a Python bool. redis-py uses isinstance(skipme, bool) to enforce this because the argument is encoded as the literal bytes b'YES' or b'NO' — any non-boolean truthiness would be ambiguous.","triggerScenarios":"Calling r.client_kill(skipme='yes'), r.client_kill(skipme=1), r.client_kill(skipme='true'), or r.client_kill(skipme=None) after passing None explicitly. Passing an int (1/0) or string instead of True/False.","commonSituations":"Developer reads 'skipme' in docs and passes a string 'yes'/'no'. Passing 1 or 0 (int) thinking Python will coerce it. Loading skipme from a config file or env var that yields a string.","solutions":["Pass skipme as a Python bool: skipme=True or skipme=False.","If the value comes from config/env as a string, convert it: skipme=str_to_bool(config_val).","Leave skipme unset (default None) to let the Redis server default to skipme=True."],"exampleFix":"# before\nr.client_kill(addr='10.0.0.1:6379', skipme='yes')\n# after\nr.client_kill(addr='10.0.0.1:6379', skipme=True)","handlingStrategy":"type-guard","validationCode":"if skipme is not None and not isinstance(skipme, bool):\n    skipme = str(skipme).lower() in ('true', 'yes', '1')\n# now safe to pass","typeGuard":"def is_skipme_bool(v) -> bool:\n    return v is None or isinstance(v, bool)","tryCatchPattern":null,"preventionTips":["Boolean flags in this client always require actual bool values, not truthy ints/strings.","When reading flags from env/config, normalize to bool before passing to redis-py."],"tags":["client-management","validation","type-error","dataerror"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}