{"record":{"id":"6ae3997f779fcef2","repo":"redis/redis-py","slug":"if-xpending-is-provided-with-idle-time-or-consumer","errorCode":null,"errorMessage":"if XPENDING is provided with idle time or consumername, it must be provided with min, max and count parameters","messagePattern":"if XPENDING is provided with idle time or consumername, it must be provided with min, max and count parameters","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":7768,"sourceCode":"        count: int,\n        consumername: ConsumerT | None = None,\n        idle: int | None = None,\n    ) -> XPendingRangeResponse | Awaitable[XPendingRangeResponse]:\n        \"\"\"\n        Returns information about pending messages, in a range.\n\n        name: name of the stream.\n        groupname: name of the consumer group.\n        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:","sourceCodeStart":7750,"sourceCodeEnd":7786,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L7750-L7786","documentation":"Raised by Redis.xpending_range() when min, max, and count are all None but idle or consumername is provided. The range filters (min/max/count) are required whenever idle or consumername filters are used; without a range the filters are meaningless. The method then delegates to the simpler xpending() form only when no filters are set.","triggerScenarios":"Calling r.xpending_range('s','g', None, None, None, consumername='c') or with idle=1000 but min=max=count=None. Because min/max/count are positional, you must explicitly pass None to reach this state.","commonSituations":"Calling xpending_range intending a summary but passing a consumer filter, or partially filling arguments.","solutions":["If you want the group summary (no range), drop idle and consumername and call r.xpending(name, group) directly.","If you want a filtered range, supply min, max, and count together with the filter."],"exampleFix":"# before\nr.xpending_range('s','g', None, None, None, consumername='c')\n\n# after -- summary form:\nr.xpending('s','g')\n# after -- filtered range form:\nr.xpending_range('s','g', '-', '+', 10, consumername='c')","handlingStrategy":"validation","validationCode":"if min is None and max is None and count is None:\n    if idle is not None or consumername is not None:\n        raise ValueError('idle/consumername require min,max,count')\n    # use summary form","typeGuard":"None","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xpending_range('s','g', mn, mx, cnt, consumername=c)\nexcept DataError as e:\n    log.warning('xpending_range arg combination invalid: %s', e)","preventionTips":["Decide up front between summary (xpending) and range (xpending_range) forms; do not mix filters with None range args."],"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"}