{"id":"5d1c1ab2a6c8a8b1","repo":"redis/redis-py","slug":"xclaim-time-must-be-an-integer","errorCode":null,"errorMessage":"XCLAIM time must be an integer","messagePattern":"XCLAIM time must be an integer","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":7310,"sourceCode":"        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\")\n            kwargs[\"parse_justid\"] = True\n        return self.execute_command(\"XCLAIM\", *pieces, **kwargs)\n\n    @overload","sourceCodeStart":7292,"sourceCodeEnd":7328,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L7292-L7328","documentation":"Raised by xclaim() when the optional `time` argument (absolute Unix-ms idle time) is provided but is not an int. Strict isinstance(int) at core.py:7309.","triggerScenarios":"xclaim(..., time='1700000000000') (str), =time_val as float. time=None or omitted is valid.","commonSituations":"Passing int(time.time()*1000) that returned a float; reading a timestamp string; a datetime-derived float.","solutions":["Pass an int Unix-ms, or None to omit.","Coerce: time = int(raw) if raw is not None else None - especially time.time()*1000 which is a float."],"exampleFix":"# before\nr.xclaim('s','g','c', 0, ['1-0'], time=time.time()*1000)  # float\n# after\nr.xclaim('s','g','c', 0, ['1-0'], time=int(time.time()*1000))","handlingStrategy":"type-guard","validationCode":"ts = int(time.time()*1000) if use_time else None\nr.xclaim(name, group, consumer, ms, ids, time=ts)","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, time=ts)\nexcept DataError:\n    r.xclaim(name, group, consumer, ms, ids, time=int(ts))","preventionTips":["time.time()*1000 is a float - always wrap in int()."],"tags":["redis","streams","xclaim","type-guard","argument-error"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}