{"record":{"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/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L7288-L7324","documentation":"Raised by Redis.xclaim() when the optional idle argument is provided and is not an int. idle sets the message's idle time (last-delivered) in ms. Only checked when idle is not None. isinstance(int) is strict, so floats/strings fail.","triggerScenarios":"Calling r.xclaim(..., idle=1.5) or idle='100'. idle=None skips the check.","commonSituations":"Passing a fractional or stringified ms value from timing instrumentation.","solutions":["Pass an int milliseconds value for idle, or omit it.","Coerce: idle = int(idle_ms) before calling."],"exampleFix":"# before\nr.xclaim('s','g','c', 0, ['1-0'], idle=now - delivered)  # float\n\n# after\nr.xclaim('s','g','c', 0, ['1-0'], idle=int(now - delivered))","handlingStrategy":"type-guard","validationCode":"if idle is not None and not isinstance(idle, int):\n    idle = int(idle)","typeGuard":"lambda v: v is None or (isinstance(v, int) and not isinstance(v, bool))","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xclaim('s','g','c', 0, ids, idle=i)\nexcept DataError as e:\n    log.warning('bad xclaim idle %r: %s', i, e)","preventionTips":["Keep timing values as int ms; coerce floats from time.time()*1000 with int()."],"tags":["stream","xclaim","validation","type-check"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}