ERR bit offset is not an integer or out of range: Bit offset is not an integer or out of range(位偏移量不是整数或超出范围)
Redis含义
传给 SETBIT/GETBIT/BITCOUNT 等位操作的位偏移量无效:不是整数或超出允许范围。Redis 无法在该偏移量处执行位操作。
原因
传入非数字值作为偏移量;使用负偏移量;或给出超过允许上限的超大偏移量(位串最大 512 MB,即约 2^32 位)。源于基于 bitmap 的计数器/标志结构中的计算错误。
解决方法
确保偏移量是允许范围内的非负整数(0 到 ~2^32-1;字符串最大 512 MB)。校验偏移量计算(例如由用户 ID 推导出的偏移量)是否溢出/为负。如果需要非常大的偏移量,将数据设计为拆分到多个键中(分片)。
同一数据库的其他条目
- ERR SELECT is not allowed in cluster modeSELECT is not allowed in cluster mode(集群模式下不允许 SELECT)
- ERR wrong number of arguments for commandWrong number of arguments for command(命令的参数数量错误)
- ERR Background save already in progressBackground save already in progress(后台保存已在进行中)
- ERR Protocol error: invalid multibulk lengthProtocol error: invalid multibulk length(协议错误:无效的 multibulk 长度)
- ERR Number of keys can't be greater than number of argsEVAL/EVALSHA: numkeys exceeds argument count(EVAL/EVALSHA:numkeys 超过参数数量)
- ERR WATCH inside MULTI is not allowedWATCH inside MULTI is not allowed(不允许在 MULTI 中使用 WATCH)
- ERR WAIT cannot be used with replica instancesWAIT cannot be used with replica instances(WAIT 不能用于副本实例)