redis/redis-py · error · DataError

XCFGSET idmp_maxsize must be an integer between 1 and 1,000,

Error message

XCFGSET idmp_maxsize must be an integer between 1 and 1,000,000

What it means

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).

Source

Thrown at redis/commands/core.py:7133

        if idmp_duration is not None:
            if (
                not isinstance(idmp_duration, int)
                or idmp_duration < 1
                or idmp_duration > 300
            ):
                raise DataError(
                    "XCFGSET idmp_duration must be an integer between 1 and 300"
                )
            pieces.extend([b"IDMP-DURATION", idmp_duration])

        if idmp_maxsize is not None:
            if (
                not isinstance(idmp_maxsize, int)
                or idmp_maxsize < 1
                or idmp_maxsize > 1000000
            ):
                raise DataError(
                    "XCFGSET idmp_maxsize must be an integer between 1 and 1,000,000"
                )
            pieces.extend([b"IDMP-MAXSIZE", idmp_maxsize])

        return self.execute_command("XCFGSET", name, *pieces)

    @overload
    def xautoclaim(
        self: SyncClientProtocol,
        name: KeyT,
        groupname: GroupT,
        consumername: ConsumerT,
        min_idle_time: int,
        start_id: StreamIdT = "0-0",
        count: int | None = None,
        justid: bool = False,
    ) -> list[Any]: ...

View on GitHub (pinned to da03cdc7e8)

Solutions

  1. Pass an int in [1, 1_000_000].
  2. Coerce and clamp from config: max(1, min(1_000_000, int(raw))).
  3. If you need more than 1M tracked iids per producer, that exceeds the server limit - revisit the mark-delay / throughput instead.

Example fix

# before
r.xcfgset('s', idmp_maxsize=rate * delay)  # float -> fails
# after
r.xcfgset('s', idmp_maxsize=max(1, min(1_000_000, int(rate * delay))))
Defensive patterns

Strategy: validation

Validate before calling

def xcfg_maxsize(raw):
    v = int(raw)
    if not 1 <= v <= 1_000_000:
        raise ValueError(f'idmp_maxsize out of range: {v}')
    return v
r.xcfgset(name, idmp_maxsize=xcfg_maxsize(raw))

Try / catch

from redis.exceptions import DataError
try:
    r.xcfgset(name, idmp_maxsize=v)
except DataError:
    v = max(1, min(1_000_000, int(v))); r.xcfgset(name, idmp_maxsize=v)

Prevention

When it happens

Trigger: xcfgset(name, idmp_maxsize=0), =1_000_001, =5e3 (float), ='1000' (str).

Common situations: 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).

Related errors


AI-assisted analysis of redis/redis-py@da03cdc7e8 (2026-08-04). Data as JSON: /data/errors/6abe3c1f288fb3c1.json. Report an issue: GitHub.