{"record":{"id":"91bb10bd32513af5","repo":"redis/redis-py","slug":"xpending-must-be-provided-with-min-max-and-count","errorCode":null,"errorMessage":"XPENDING must be provided with min, max and count parameters, or none of them.","messagePattern":"XPENDING must be provided with min, max and count parameters, or none of them\\.","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":7777,"sourceCode":"        idle: available from  version 6.2. filter entries by their\n        idle-time, given in milliseconds (optional).\n        min: minimum stream ID.\n        max: maximum stream ID.\n        count: number of messages to return\n        consumername: name of a consumer to filter by (optional).\n        \"\"\"\n        if {min, max, count} == {None}:\n            if idle is not None or consumername is not None:\n                raise DataError(\n                    \"if XPENDING is provided with idle time\"\n                    \" or consumername, it must be provided\"\n                    \" with min, max and count parameters\"\n                )\n            return self.xpending(name, groupname)\n\n        pieces = [name, groupname]\n        if min is None or max is None or count is None:\n            raise DataError(\n                \"XPENDING must be provided with min, max \"\n                \"and count parameters, or none of them.\"\n            )\n        # idle\n        try:\n            if int(idle) < 0:\n                raise DataError(\"XPENDING idle must be a integer >= 0\")\n            pieces.extend([\"IDLE\", idle])\n        except TypeError:\n            pass\n        # count\n        try:\n            if int(count) < 0:\n                raise DataError(\"XPENDING count must be a integer >= 0\")\n            pieces.extend([min, max, count])\n        except TypeError:\n            pass\n        # consumername","sourceCodeStart":7759,"sourceCodeEnd":7795,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L7759-L7795","documentation":"Raised by Redis.xpending_range() when some but not all of min/max/count are None. They must be supplied together (all three) or all omitted. The first branch handles all-None; this branch catches the partial case.","triggerScenarios":"Calling r.xpending_range('s','g', '0-0', None, 10) (max missing) or r.xpending_range('s','g', None, '+', 10) (min missing).","commonSituations":"Forgetting one of the three positional args, or conditionally building only some of them.","solutions":["Supply min, max, and count together, or omit all three (use xpending for summary).","Build them as a tuple and pass atomically: if any is None, treat as summary."],"exampleFix":"# before\nr.xpending_range('s','g', '0-0', None, 10)  # max missing -> raises\n\n# after\nr.xpending_range('s','g', '0-0', '+', 10)","handlingStrategy":"validation","validationCode":"if (min is None) ^ (max is None) ^ (count is None) or (min is None and (max is not None or count is not None)):\n    raise ValueError('min, max, count must be supplied together or all omitted')","typeGuard":"None","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xpending_range('s','g', mn, mx, cnt)\nexcept DataError as e:\n    log.warning('xpending_range needs all or none of min/max/count: %s', e)","preventionTips":["Treat (min, max, count) as a single optional triple in your calling code."],"tags":["stream","xpending","validation","argument-combination"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}