ERR Number of keys can't be greater than number of args: EVAL/EVALSHA: numkeys exceeds argument count (numkeys가 인수 개수를 초과)
Redis의미
Lua 스크립트(EVAL/EVALSHA/FCALL)를 실행할 때 지정한 키 수(numkeys)가 명령에 실제로 전달된 인수 수보다 크다. Redis가 KEYS와 ARGV 배열을 나눌 수 없어 명령을 거부한다.
원인
EVAL 구문은 'EVAL script numkeys key [key ...] arg [arg ...]'다. numkeys 값을 잘못 계산했거나(너무 크게 설정) 예상한 키를 명령에 추가하지 않았다. 흔한 프로그래밍 실수다.
해결 방법
numkeys를 명령에 실제로 전달한 키 수와 정확히 같게 한다. 클라이언트 라이브러리의 EVAL 래퍼(보통 KEYS와 ARGV를 별도 목록으로 받는다)를 사용해 numkeys가 자동 계산되도록 한다. 스크립트를 호출할 때 키는 KEYS로, 다른 파라미터는 ARGV로 올바르게 나눈다.
같은 데이터베이스의 다른 항목
- ERR Background save already in progressBackground save already in progress
- ERR bit offset is not an integer or out of rangeBit offset is not an integer or out of range (비트 오프셋이 정수가 아니거나 범위를 벗어남)
- ERR Protocol error: invalid multibulk lengthProtocol error: invalid multibulk length (프로토콜 오류: 유효하지 않은 multibulk 길이)
- ERR WATCH inside MULTI is not allowedWATCH inside MULTI is not allowed
- ERR WAIT cannot be used with replica instancesWAIT cannot be used with replica instances (replica 인스턴스에서는 WAIT 사용 불가)
- ERR Background append only file rewriting already in progressAOF rewrite already in progress
- IOERR error or timeout reading from target instanceMIGRATE: I/O error or timeout to target