{"record":{"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":"exception","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/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L764-L800","documentation":"Raised by client_kill() (redis/commands/core.py:782) when the 'skipme' argument is not a Python bool. The library must emit the literal wire tokens b\"YES\"/b\"NO\", so it enforces isinstance(skipme, bool) strictly; truthy/falsy values like the string \"YES\", the int 1, or \"true\" are rejected. skipme=None is allowed and simply omits the filter. This is a redis.exceptions.DataError raised client-side before any network round trip.","triggerScenarios":"Calling r.client_kill(skipme=\"YES\"), r.client_kill(skipme=1), r.client_kill(skipme=\"true\"), or r.client_kill(skipme=0). Any non-bool, non-None value triggers it. The default skipme=None does NOT trigger it.","commonSituations":"Developers copy the literal SKIPME YES/NO tokens from the Redis CLI/server docs and pass them as strings; or they assume Python truthiness (0/1) is accepted. Common when porting raw command examples into the python client.","solutions":["Pass a literal Python bool: r.client_kill(skipme=True) or r.client_kill(skipme=False)","Omit skipme entirely (default None) if you do not need to control self-exclusion","If skipme comes from config, coerce explicitly: r.client_kill(skipme=bool(user_value))"],"exampleFix":"# before\nr.client_kill(skipme=\"YES\")\n# after\nr.client_kill(skipme=True)","handlingStrategy":"validation","validationCode":"if skipme is not None and not isinstance(skipme, bool):\n    raise TypeError(\"skipme must be bool or None\")\nr.client_kill(skipme=skipme)","typeGuard":"def is_skipme(v) -> TypeGuard[bool]:\n    return isinstance(v, bool)","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.client_kill(skipme=val)\nexcept DataError as e:\n    if \"skipme must be a bool\" in str(e):\n        r.client_kill(skipme=bool(val))\n    else:\n        raise","preventionTips":["Treat skipme as a Python bool only; never pass the wire tokens 'YES'/'NO'.","Centralize client_kill option building in one helper so types are enforced once.","Enable strict type checking (mypy) on the call site."],"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"}