There's a TODO in command.go:
// TODO: Use the data in CommandInfo to determine the first key position.
Right now cmdFirstKeyPos hardcodes a handful of special cases and falls back to position 1 for everything else. The problem is we already fetch CommandInfo (which includes FirstKeyPos) via COMMAND INFO and cache it, we're just not using it here.
The keylessCommands map also has to be kept in sync manually, which is easy to get wrong as new commands are added.
The fix would be to look up CommandInfo in cmdFirstKeyPos when available and use FirstKeyPos from there, keeping the current logic as a fallback for cold cache. The eval/evalsha family would still need special handling since their key position depends on the numkeys argument at runtime.
There's a TODO in command.go:
// TODO: Use the data in CommandInfo to determine the first key position.Right now cmdFirstKeyPos hardcodes a handful of special cases and falls back to position 1 for everything else. The problem is we already fetch CommandInfo (which includes FirstKeyPos) via COMMAND INFO and cache it, we're just not using it here.
The keylessCommands map also has to be kept in sync manually, which is easy to get wrong as new commands are added.
The fix would be to look up CommandInfo in cmdFirstKeyPos when available and use FirstKeyPos from there, keeping the current logic as a fallback for cold cache. The eval/evalsha family would still need special handling since their key position depends on the numkeys argument at runtime.