ERR wrong number of arguments for command: Wrong number of arguments for command
Redis의미
Redis 명령이 예상보다 적거나 많은 인수로 전송되었다. 구문을 충족하지 않아 명령이 처리되지 않고 거부되었다.
원인
누락되었거나 초과된 파라미터(예: SET key value 대신 SET key만), 빈 값/undefined로 전달된 변수, 잘못된 인수 순서로 호출된 명령, 클라이언트 라이브러리의 잘못된 배열/인수 전개(spread)가 원인이다. 동적으로 생성한 명령에서 흔하다.
해결 방법
명령의 올바른 시그니처를 확인한다(예: SET key value [options]). 공식 명령 레퍼런스를 참고한다. 클라이언트 코드에서 인수(특히 배열에서 오는 인수)가 비어 있거나 누락되지 않았는지 확인한다. 사용자 입력으로 명령을 만든다면 사전에 인수 개수를 검증한다. redis-cli에서 명령을 직접 실행해 예상 인수 개수를 확인한다.
같은 데이터베이스의 다른 항목
- DENIED Redis is running in protected modeRedis is running in protected mode
- ERR Can't execute '<cmd>': only (P|S)SUBSCRIBE / (P|S)UNSUBSCRIBE / PING / QUIT / RESET are allowed in this contextCommand not allowed in subscribe context (subscribe 컨텍스트에서 허용되지 않는 명령)
- ERR SELECT is not allowed in cluster modeSELECT is not allowed in cluster mode
- 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 Number of keys can't be greater than number of argsEVAL/EVALSHA: numkeys exceeds argument count (numkeys가 인수 개수를 초과)