ERR redis data_error ai_generated true

ERR Stream 'mystream' has too many entries, old entries will be dropped due to MAXLEN

ID: redis/stream-entries-maxlen-dropped

Also available as: JSON · Markdown · 中文
88%Fix Rate
85%Confidence
1Evidence
2023-12-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
7.2.0 active
7.4.0 active
8.0.0 active

Root Cause

Stream reached its configured MAXLEN limit, causing automatic eviction of oldest entries.

generic

中文

流达到配置的 MAXLEN 限制,导致自动淘汰最旧条目。

Official Documentation

https://redis.io/docs/data-types/streams/

Workarounds

  1. 85% success Increase MAXLEN to a higher value: XTRIM mystream MAXLEN ~ 1000000. Use the ~ (tilde) for approximate trimming to reduce overhead.
    Increase MAXLEN to a higher value: XTRIM mystream MAXLEN ~ 1000000. Use the ~ (tilde) for approximate trimming to reduce overhead.
  2. 75% success Set a time-based retention policy using MINID: XTRIM mystream MINID ~ 1715000000 (Unix timestamp).
    Set a time-based retention policy using MINID: XTRIM mystream MINID ~ 1715000000 (Unix timestamp).

中文步骤

  1. 将 MAXLEN 增加到更高值:XTRIM mystream MAXLEN ~ 1000000。使用 ~(波浪号)进行近似修剪以减少开销。
  2. 使用 MINID 设置基于时间的保留策略:XTRIM mystream MINID ~ 1715000000(Unix 时间戳)。

Dead Ends

Common approaches that don't work:

  1. 40% fail

    Setting MAXLEN to 0 disables the limit entirely, but may cause unbounded memory growth and eventual OOM.

  2. 60% fail

    Manually deleting entries with XDEL does not reduce the stream length counter; only XTRIM works.