You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: JSON.ARRPOP treats a non-integer index as -1 and removes the last array element #1713
[Bug]: JSON.ARRPOP treats a non-integer index as -1 and removes the last array element
What happened?
When an explicit JSON.ARRPOP index is not an integer, RedisJSON treats it as -1. The command succeeds and removes the final array element instead of rejecting the invalid argument.
Steps to reproduce
Run on a disposable Redis 8.10.3 server with RedisJSON 8.10.0 loaded and an empty logical database. Confirm the key does not exist before running:
Both invalid indexes return 30; the following JSON.GET returns [[10,20]]. A valid index of -1 also returns 30, showing that both invalid values are treated as the default last index.
Expected behavior
Reject a supplied non-integer index and leave the JSON document unchanged. This report does not depend on a particular error message.
OS
Linux x86_64 (Ubuntu 24.04)
CPU Architecture
x86_64
Redis Server Version
8.10.3
Redis Module Version
RedisJSON 8.10.0
Docker Installation
Tested with Redis Open Source 8.10.3 and its bundled RedisJSON module; no standalone RedisJSON Docker Hub release was used.
I installed the dockerhub release
Relevant log output
No separate server log excerpt; the command replies above are the relevant output.
Additional context
The command schema defines index as an integer. In the tested RedisJSON source, the optional index parser uses args.next_i64().unwrap_or(-1), so a parse failure is treated the same as an omitted argument: index parsing and argument metadata.
Activity