{"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/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L7750-L7786","documentation":"Raised by xpending_range() when min, max, and count are ALL None (summary mode) but idle or consumername is also supplied. Filters are meaningless without a range, so the client rejects the combination. Check at core.py:7766-7772 uses the set trick `{min,max,count} == {None}`.","triggerScenarios":"r.xpending_range('s','g', None, None, None, idle=5000) or xpending_range('s','g',None,None,None, consumername='c1'). All three of min/max/count must be None for this branch (partial-None hits [338] instead).","commonSituations":"Calling xpending_range intending the summary form (xpending) but tacking on an idle filter; passing None positionals explicitly then a filter kwarg.","solutions":["For a filtered/paginated result, supply all of min, max, count.","For the summary (no range), drop idle and consumername and call xpending(name, group) directly.","Decide up front which XPENDING form you want - summary OR range, not a mix."],"exampleFix":"# before\nr.xpending_range('s','g', None, None, None, idle=5000)\n# after - pick one:\nr.xpending_range('s','g', '-', '+', 10, idle=5000)   # range form\n# or\nr.xpending('s','g')                                   # summary form","handlingStrategy":"validation","validationCode":"if min is max is count is None:\n    if idle is not None or consumername is not None:\n        raise ValueError('idle/consumername require min,max,count')\n    r.xpending(name, group)\nelse:\n    r.xpending_range(name, group, min, max, count, consumername=consumername, idle=idle)","typeGuard":null,"tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xpending_range(name, group, min, max, count, idle=idle, consumername=cn)\nexcept DataError:\n    r.xpending(name, group)  # fall back to summary","preventionTips":["Pick one XPENDING shape: summary (no range, no filters) or range (min,max,count).","idle/consumername are only valid with a full range."],"tags":["redis","streams","xpending","validation","argument-interdependency"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}