{"record":{"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/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L7292-L7328","documentation":"Raised by Redis.xclaim() when the optional time argument is provided and is not an int. time sets idle to an absolute Unix-ms timestamp (unlike idle which is relative). Strict isinstance(int); floats/strings fail.","triggerScenarios":"Calling r.xclaim(..., time=int(time.time()*1000)) where the expression is a float, or time='1690000000000'.","commonSituations":"Forgetting to wrap time.time()*1000 in int(), or passing a datetime string.","solutions":["Pass an int Unix-ms timestamp for time, or omit it.","Coerce: time = int(time.time() * 1000)."],"exampleFix":"# before\nr.xclaim('s','g','c', 0, ['1-0'], time=time.time() * 1000)  # float\n\n# after\nimport time\nr.xclaim('s','g','c', 0, ['1-0'], time=int(time.time() * 1000))","handlingStrategy":"type-guard","validationCode":"if time is not None and not isinstance(time, int):\n    time = int(time)","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, time=t)\nexcept DataError as e:\n    log.warning('bad xclaim time %r: %s', t, e)","preventionTips":["time.time()*1000 is a float -- always wrap in int() before passing to xclaim."],"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"}