{"id":"d0903dd698b75c92","repo":"redis/redis-py","slug":"xclaim-justid-must-be-a-boolean","errorCode":null,"errorMessage":"XCLAIM justid must be a boolean","messagePattern":"XCLAIM justid must be a boolean","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":7323,"sourceCode":"            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\n    def xdel(self: SyncClientProtocol, name: KeyT, *ids: StreamIdT) -> int: ...\n\n    @overload\n    def xdel(\n        self: AsyncClientProtocol, name: KeyT, *ids: StreamIdT\n    ) -> Awaitable[int]: ...\n\n    def xdel(self, name: KeyT, *ids: StreamIdT) -> int | Awaitable[int]:\n        \"\"\"\n        Deletes one or more messages from a stream.\n\n        Args:\n            name: name of the stream.","sourceCodeStart":7305,"sourceCodeEnd":7341,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L7305-L7341","documentation":"Raised by xclaim() when `justid` is truthy but not a bool. Same shape as the force guard: it sits under `if justid:` (core.py:7321), so falsy non-bools slip through; truthy non-bools (1, 'yes') raise.","triggerScenarios":"xclaim(..., justid=1), =justid='true'), =justid='1'). justid=0/None does NOT raise. justid=True/False is correct.","commonSituations":"Passing justid from a query param or env flag as a string; an int 0/1.","solutions":["Pass an actual bool: justid=bool(flag).","Normalize string flags before the call."],"exampleFix":"# before\nr.xclaim('s','g','c', 0, ['1-0'], justid=req.args.get('justid'))  # '1'\n# after\nr.xclaim('s','g','c', 0, ['1-0'], justid=str(req.args.get('justid')).lower() in {'1','true','yes'})","handlingStrategy":"type-guard","validationCode":"justid = bool(justid)\nr.xclaim(name, group, consumer, ms, ids, justid=justid)","typeGuard":"def as_bool(v) -> bool:\n    if isinstance(v, bool): return v\n    if isinstance(v, str): return v.strip().lower() in {'1','true','yes','on'}\n    return bool(v)","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xclaim(name, group, consumer, ms, ids, justid=justid)\nexcept DataError:\n    r.xclaim(name, group, consumer, ms, ids, justid=bool(justid))","preventionTips":["Coerce justid with bool() - it also gates the parse_justid response shape."],"tags":["redis","streams","xclaim","type-guard","argument-error","truthy-guard"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}