{"id":"6abe3c1f288fb3c1","repo":"redis/redis-py","slug":"xcfgset-idmp-maxsize-must-be-an-integer-between-1","errorCode":null,"errorMessage":"XCFGSET idmp_maxsize must be an integer between 1 and 1,000,000","messagePattern":"XCFGSET idmp_maxsize must be an integer between 1 and 1,000,000","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":7133,"sourceCode":"\n        if idmp_duration is not None:\n            if (\n                not isinstance(idmp_duration, int)\n                or idmp_duration < 1\n                or idmp_duration > 300\n            ):\n                raise DataError(\n                    \"XCFGSET idmp_duration must be an integer between 1 and 300\"\n                )\n            pieces.extend([b\"IDMP-DURATION\", idmp_duration])\n\n        if idmp_maxsize is not None:\n            if (\n                not isinstance(idmp_maxsize, int)\n                or idmp_maxsize < 1\n                or idmp_maxsize > 1000000\n            ):\n                raise DataError(\n                    \"XCFGSET idmp_maxsize must be an integer between 1 and 1,000,000\"\n                )\n            pieces.extend([b\"IDMP-MAXSIZE\", idmp_maxsize])\n\n        return self.execute_command(\"XCFGSET\", name, *pieces)\n\n    @overload\n    def xautoclaim(\n        self: SyncClientProtocol,\n        name: KeyT,\n        groupname: GroupT,\n        consumername: ConsumerT,\n        min_idle_time: int,\n        start_id: StreamIdT = \"0-0\",\n        count: int | None = None,\n        justid: bool = False,\n    ) -> list[Any]: ...\n","sourceCodeStart":7115,"sourceCodeEnd":7151,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L7115-L7151","documentation":"Raised by xcfgset() when idmp_maxsize is provided but is not an int, or is outside [1, 1_000_000]. Strict isinstance(int) check at core.py:7128-7135; floats/strings fail, bool passes as 0/1 (True==1 passes, False==0 fails the <1 test).","triggerScenarios":"xcfgset(name, idmp_maxsize=0), =1_000_001, =5e3 (float), ='1000' (str).","commonSituations":"Deriving maxsize from a rate formula (mark-delay * msgs/msec) that returned a float or went huge; reading a human string like '10k' from config; setting 0 to mean 'unlimited' (the real max is 1M).","solutions":["Pass an int in [1, 1_000_000].","Coerce and clamp from config: max(1, min(1_000_000, int(raw))).","If you need more than 1M tracked iids per producer, that exceeds the server limit - revisit the mark-delay / throughput instead."],"exampleFix":"# before\nr.xcfgset('s', idmp_maxsize=rate * delay)  # float -> fails\n# after\nr.xcfgset('s', idmp_maxsize=max(1, min(1_000_000, int(rate * delay))))","handlingStrategy":"validation","validationCode":"def xcfg_maxsize(raw):\n    v = int(raw)\n    if not 1 <= v <= 1_000_000:\n        raise ValueError(f'idmp_maxsize out of range: {v}')\n    return v\nr.xcfgset(name, idmp_maxsize=xcfg_maxsize(raw))","typeGuard":null,"tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xcfgset(name, idmp_maxsize=v)\nexcept DataError:\n    v = max(1, min(1_000_000, int(v))); r.xcfgset(name, idmp_maxsize=v)","preventionTips":["Sizing formula: maxsize ~= msgs_per_ms * mark_delay_ms + margin.","Clamp to the documented 1M ceiling before sending."],"tags":["redis","streams","xcfgset","validation","range-error"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}