ERR invalid expire time in 'set' command: invalid expire time in SET
RedisWhat does it mean?
An invalid expiration time was given to SET (with the EX/PX/EXAT/PXAT options). Redis rejected the command because it does not accept a meaningless time to live such as zero or a negative value.
Why does it happen?
Sending 0 or a negative value with EX/PX, or the application miscalculating the expiration and producing an invalid number. Commands such as SETEX/GETEX return this error similarly for non-positive durations. Some client bugs come from mixing up seconds and milliseconds.
How to fix it
Always send the expiration as a strictly positive integer; EX expects seconds, PX milliseconds. Validate the duration calculation in the application (it must not produce negative/zero results) and do not mix up units (seconds vs. milliseconds). To delete a key immediately, use DEL/UNLINK instead of setting an expiration. For absolute time, pass a valid future Unix timestamp to EXAT/PXAT.