{"id":"22b6cb3ac3d3945e","repo":"redis/redis-py","slug":"xcfgset-requires-at-least-one-of-idmp-duration-or","errorCode":null,"errorMessage":"XCFGSET requires at least one of idmp_duration or idmp_maxsize","messagePattern":"XCFGSET requires at least one of idmp_duration or idmp_maxsize","errorType":"validation","errorClass":"DataError","httpStatus":null,"severity":"error","filePath":"redis/commands/core.py","lineNumber":7110,"sourceCode":"            idmp_duration: How long Redis remembers each iid in seconds.\n                Default: 100 seconds (or value set by stream-idmp-duration config).\n                Minimum: 1 second, Maximum: 300 seconds.\n                Redis won't forget an iid for this duration (unless maxsize is reached).\n                Should accommodate application crash recovery time.\n            idmp_maxsize: Maximum number of iids Redis remembers per producer ID (pid).\n                Default: 100 iids (or value set by stream-idmp-maxsize config).\n                Minimum: 1 iid, Maximum: 1,000,000 (1M) iids.\n                Should be set to: mark-delay [in msec] × (messages/msec) + margin.\n                Example: 10K msgs/sec (10 msgs/msec), 80 msec mark-delay\n                → maxsize = 10 × 80 + margin = 1000 iids.\n\n        Returns:\n            OK on success.\n\n        For more information, see https://redis.io/commands/xcfgset\n        \"\"\"\n        if idmp_duration is None and idmp_maxsize is None:\n            raise DataError(\n                \"XCFGSET requires at least one of idmp_duration or idmp_maxsize\"\n            )\n\n        pieces: list[EncodableT] = []\n\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 (","sourceCodeStart":7092,"sourceCodeEnd":7128,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/commands/core.py#L7092-L7128","documentation":"Raised by xcfgset() when both idmp_duration and idmp_maxsize are left as None. XCFGSET configures a stream's idempotency tracking; providing no value at all is a no-op, so the client rejects it with DataError before contacting Redis.","triggerScenarios":"Call r.xcfgset('mystream') with no keyword arguments, or r.xcfgset('mystream', None, None). The check at core.py:7109 is `if idmp_duration is None and idmp_maxsize is None`.","commonSituations":"Config built from a dict that resolved to empty; copy-pasting a template without filling values; a conditional that set neither branch; calling XCFGSET expecting it to reset to defaults.","solutions":["Pass at least one of idmp_duration (int seconds) or idmp_maxsize (int count).","If you meant to inspect rather than set config, there is no read call here - just omit XCFGSET.","Guard the call: if cfg: r.xcfgset(name, **cfg)."],"exampleFix":"# before\nr.xcfgset('mystream')\n# after\nr.xcfgset('mystream', idmp_duration=120, idmp_maxsize=5000)","handlingStrategy":"validation","validationCode":"if idmp_duration is None and idmp_maxsize is None:\n    raise ValueError('supply at least one of idmp_duration / idmp_maxsize')\nr.xcfgset(name, idmp_duration=idmp_duration, idmp_maxsize=idmp_maxsize)","typeGuard":null,"tryCatchPattern":"from redis.exceptions import DataError\ntry:\n    r.xcfgset(name, **cfg)\nexcept DataError as e:\n    log.warning('skipping XCFGSET, no values: %s', e)","preventionTips":["Treat XCFGSET as 'set at least one knob' - never call it bare.","Build the kwargs dict and skip the call when empty."],"tags":["redis","streams","xcfgset","validation","argument-error"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}