// Redis error reference

ERR wrong number of arguments: Argument count is wrong

The command name is known but the argument count is not: each command declares a minimum, and fixed-arity commands also refuse extra arguments.

Error prefix
ERR wrong number of arguments
카테고리
Data types and commands
오류 메시지
ERR wrong number of arguments for 'get' command

의미

Every Redis command declares an arity: how many arguments it accepts, counting the command name itself. When the client sends fewer arguments than the minimum, or more than a fixed-arity command allows, Redis refuses with this message naming the command. The check happens before anything executes, so a rejected call has written nothing: SETNX k v extra fails with this message and leaves k unset. SET takes a variable number of arguments, so a stray token there gives ERR syntax error instead.

The usual source is the client layer: a nil argument dropped from the array, an option appended twice, or a driver joining arguments into one string instead of sending them as separate bulk strings. Commands with fixed shapes such as GET are strict; SET is deliberately loose because it takes many option forms.

일반적인 원인

  • A nil or empty value was dropped by the client library, leaving a gap in the argument list.
  • Arguments were joined into one string or split wrongly instead of being sent as separate RESP bulk strings.
  • An option was repeated, or an extra positional argument was appended to a fixed-arity command.

Find the cause

COMMAND INFO zadd
# arity -4: ZADD key [options] score member [score member ...]
# What the server actually runs, one line per executed command. A call rejected by the arity check does not appear:
MONITOR
# Watch a single request, then stop: MONITOR mirrors every command and costs latency

해결 방법

  1. Check the exact arity Redis expects; a negative value means 'at least':

    COMMAND INFO get
    # arity 2: GET key, exactly
    COMMAND INFO set
    # arity -3: SET key value [options...], at least
  2. Log the argument array the client actually builds, including nils and empty strings, and compare it with the intended call.

  3. Run the command by hand with the intended arguments to separate a client bug from a usage bug:

    GET mykey
    # (nil) is a missing key, not an error
    GET
    # (error) ERR wrong number of arguments for 'get' command

Other ways to handle it

Typed clients build arity correctly for the commands they support; drop to raw EVAL or custom commands only when a wrapper lags behind a new server feature. For commands with variable arguments, validate the count in application code before the call.

안전하게 재현하세요

redis-cli GET
# (error) ERR wrong number of arguments for 'get' command
redis-cli GET mykey extra
# (error) ERR wrong number of arguments for 'get' command
redis-cli GET mykey
# (nil)

질문

Does the argument count include the command name?

Yes. GET has arity 2: the word GET plus one key. That is why a bare GET is reported against the get command.

Can a command accept unlimited arguments?

Commands such as RPUSH, SADD and DEL have negative arity, meaning 'at least N'. For them the error means you dropped below the minimum, not above a maximum.

관련 오류

More data types and commands errors

코드와 메시지 텍스트의 출처는 다음과 같습니다 Redis documentation and source code. 전체 목록은 Redis error list 또는 모든 데이터베이스 오류 검색.

// 오류는 줄이고, 수정은 빠르게

Work on Redis in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Redis and the other databases you use.

이 페이지의 텍스트와 데이터: CC BY 4.0, 출처: SQLly (sqlly.app). 코드와 SQL 스니펫: MIT. 라이선스 세부 정보 인용된 오류 메시지 텍스트의 권리는 해당 데이터베이스 공급업체에 있습니다.