{"id":"b19e3b4253374dde","repo":"redis/redis-py","slug":"xclaim-idle-must-be-an-integer","errorCode":null,"errorMessage":"XCLAIM idle must be an integer","messagePattern":"XCLAIM idle must be an integer","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":7306,"sourceCode":"        of messages successfully claimed, without returning the actual message\n\n        For more information, see https://redis.io/commands/xclaim\n        \"\"\"\n        if not isinstance(min_idle_time, int) or min_idle_time < 0:\n            raise DataError(\"XCLAIM min_idle_time must be a non negative integer\")\n        if not isinstance(message_ids, (list, tuple)) or not message_ids:\n            raise DataError(\n                \"XCLAIM message_ids must be a non empty list or \"\n                \"tuple of message IDs to claim\"\n            )\n\n        kwargs = {}\n        pieces: list[EncodableT] = [name, groupname, consumername, str(min_idle_time)]\n        pieces.extend(list(message_ids))\n\n        if idle is not None:\n            if not isinstance(idle, int):\n                raise DataError(\"XCLAIM idle must be an integer\")\n            pieces.extend((b\"IDLE\", str(idle)))\n        if time is not None:\n            if not isinstance(time, int):\n                raise DataError(\"XCLAIM time must be an integer\")\n            pieces.extend((b\"TIME\", str(time)))\n        if retrycount is not None:\n            if not isinstance(retrycount, int):\n                raise DataError(\"XCLAIM retrycount must be an integer\")\n            pieces.extend((b\"RETRYCOUNT\", str(retrycount)))\n\n        if force:\n            if not isinstance(force, bool):\n                raise DataError(\"XCLAIM force must be a boolean\")\n            pieces.append(b\"FORCE\")\n        if justid:\n            if not isinstance(justid, bool):\n                raise DataError(\"XCLAIM justid must be a boolean\")\n            pieces.append(b\"JUSTID\")","sourceCodeStart":7288,"sourceCodeEnd":7324,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L7288-L7324","documentation":"Raised by xclaim() when the optional `idle` argument is provided but is not an int. Strict isinstance(int) at core.py:7305; passing None is fine (omits the IDLE option).","triggerScenarios":"xclaim(..., idle='100') (str), =100.0 (float). idle=None or omitted is valid.","commonSituations":"Passing a duration from config as a string; a float ms value; a Decimal.","solutions":["Pass an int milliseconds, or None to omit.","Coerce: idle = int(raw) if raw is not None else None."],"exampleFix":"# before\nr.xclaim('s','g','c', 0, ['1-0'], idle='100')\n# after\nr.xclaim('s','g','c', 0, ['1-0'], idle=100)","handlingStrategy":"type-guard","validationCode":"idle = int(idle) if idle is not None else None\nr.xclaim(name, group, consumer, ms, ids, idle=idle)","typeGuard":"def opt_int(v): return v if v is None else int(v)","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xclaim(name, group, consumer, ms, ids, idle=idle)\nexcept DataError:\n    r.xclaim(name, group, consumer, ms, ids, idle=int(idle))","preventionTips":["Coerce optional numeric kwargs with int() unless they are None."],"tags":["redis","streams","xclaim","type-guard","argument-error"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}