{"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/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L7759-L7795","documentation":"Raised by xpending_range() when min, max, count are PARTIALLY provided (some None, some not). They must be all-present or all-absent together. Check at core.py:7776: `if min is None or max is None or count is None`. This branch is only reached after the all-None case ([337] path) was excluded.","triggerScenarios":"r.xpending_range('s','g','0-0', None, 10) (max missing), =('s','g', None, '+', 10) (min missing), r.xpending_range('s','g','0-0','+',None) (count missing).","commonSituations":"Mixing keyword and positional args and leaving one as its required-but-None slot; forgetting one of the three; passing count from a config that was unset.","solutions":["Provide all three: min, max, AND count.","Use '+' for max and '-' for min when you want the full pending range.","If you only want the summary, pass all three as None and drop idle/consumername."],"exampleFix":"# before\nr.xpending_range('s','g','0-0', None, 10)  # max is None\n# after\nr.xpending_range('s','g','0-0', '+', 10)","handlingStrategy":"validation","validationCode":"if (min is None) != (max is None) or (min is None) != (count is None):\n    raise ValueError('min, max, count must be all set or all None')\nif min is None:\n    r.xpending(name, group)\nelse:\n    r.xpending_range(name, group, min, max, count)","typeGuard":null,"tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xpending_range(name, group, min, max, count)\nexcept DataError:\n    # fill in sensible defaults for the missing one\n    r.xpending_range(name, group, min or '-', max or '+', count or 10)","preventionTips":["min/max/count are atomic - supply all three or none.","'-' / '+' are the conventional min/max stream-id bounds."],"tags":["redis","streams","xpending","validation","argument-interdependency"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}