diff --git a/redis/commands/core.py b/redis/commands/core.py index 771fed9e0c..ab246a7b81 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -3842,7 +3842,7 @@ def xrevrange( def xtrim( self, name: KeyT, - maxlen: Union[int, None], + maxlen: Union[int, None] = None, approximate: bool = True, minid: Union[StreamIdT, None] = None, limit: Union[int, None] = None, @@ -3863,6 +3863,9 @@ def xtrim( if maxlen is not None and minid is not None: raise DataError("Only one of ``maxlen`` or ``minid`` " "may be specified") + if maxlen is None and minid is None: + raise DataError("One of ``maxlen`` or ``minid`` must be specified") + if maxlen is not None: pieces.append(b"MAXLEN") if minid is not None: