{"record":{"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/6a6b581b48225afa0b76912d1028c6035baee932/redis/commands/core.py#L7115-L7151","documentation":"Raised by Redis.xcfgset() when idmp_maxsize is not an int, or is outside [1, 1,000,000]. idmp_maxsize caps how many idempotency IDs the server tracks; sized roughly as mark-delay(ms) * messages-per-ms + margin. Validated client-side; None skips the check.","triggerScenarios":"Calling r.xcfgset('mystream', idmp_maxsize=<v>) where <v> is a float/string, or an int <1 or >1_000_000 (e.g. 0, -5, 2_000_000). Guard: `not isinstance(idmp_maxsize, int) or v < 1 or v > 1000000`.","commonSituations":"Computing maxsize from throughput/delay and rounding to a value over the cap, loading it as a string from config, or passing 0 to 'disable'.","solutions":["Pass an int within [1, 1_000_000].","Clamp computed values: idmp_maxsize=max(1, min(1_000_000, int(computed))).","Coerce string config with int() before calling."],"exampleFix":"# before\nr.xcfgset('mystream', idmp_maxsize=1_500_000)\n\n# after\nr.xcfgset('mystream', idmp_maxsize=1_000_000)","handlingStrategy":"validation","validationCode":"def valid_idmp_maxsize(v):\n    return v is None or (isinstance(v, int) and not isinstance(v, bool) and 1 <= v <= 1_000_000)\n\nif not valid_idmp_maxsize(idmp_maxsize):\n    raise ValueError('idmp_maxsize must be int in [1,1000000]')","typeGuard":"lambda v: v is None or (isinstance(v, int) and not isinstance(v, bool) and 1 <= v <= 1_000_000)","tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xcfgset('mystream', idmp_maxsize=ms)\nexcept DataError as e:\n    log.warning('bad idmp_maxsize %r: %s', ms, e)","preventionTips":["Validate at the config boundary and clamp into the documented range.","The cap is 1,000,000; size maxsize to your mark-delay * throughput, not to an arbitrary large number."],"tags":["stream","xcfgset","validation","idempotency"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}