// Redis error reference

ERR unknown command: Redis does not know this command

The first word of the command is not one this server knows: a typo, an unsupported module command, or a client newer than the server.

Error prefix
ERR unknown command
카테고리
Data types and commands
오류 메시지
ERR unknown command 'HGETALLX', with args beginning with: 'myhash' 

의미

This is Redis's failure for the command name itself. The server looked up the first token and found no command with that name, so it reports the name and the first arguments it received, and nothing executed.

The common causes are a typo, a command that exists only in a newer Redis than the server runs, a module command arriving while the module is not loaded, and proxies or ORMs that mangle the name. Redis is case-insensitive about command names, so casing is never the problem, but appended suffixes are. A close sibling message, unknown subcommand '...', appears when a known command gets an unrecognized subcommand.

일반적인 원인

  • A typo in the command name, or a client library assembling the command array wrong.
  • The command exists only in Redis versions newer than the one connected to.
  • A module command was sent to a server that has not loaded that module.
  • A proxy or query builder split or prefixed the command line on the way through.

Find the cause

COMMAND INFO hgetallx
# (nil): not a command on this server
COMMAND INFO hgetall
# The correctly spelled command, with its arity and flags
INFO server | grep redis_version
MODULE LIST
# Compare against the module or version the feature needs

해결 방법

  1. Confirm the spelling and whether this server supports the command at all:

    COMMAND INFO XADD
    # (nil) means this server has never heard of it
    COMMAND COUNT
  2. Compare the server version with the version that introduced the command, and upgrade if the command is newer:

    INFO server | grep redis_version
  3. Load the module if the command belongs to one:

    MODULE LIST
    MODULE LOAD /usr/lib/redis/modules/redistimeseries.so

Other ways to handle it

For version-dependent features, gate the call in code on the server version from INFO server instead of catching the error at runtime. Where a module is required, load it through the loadmodule configuration directive so a restart does not silently drop the command again.

안전하게 재현하세요

redis-cli HGETALLX myhash
# (error) ERR unknown command 'HGETALLX', with args beginning with: 'myhash' 
redis-cli HGETALL myhash
# works

질문

Are Redis command names case-sensitive?

No. GET and get are the same command. The name in the error is what you sent, so check spelling, not case.

Why does the same code work in another environment?

The other server is probably a newer Redis or has the module loaded. Compare redis_version from INFO server and MODULE LIST between the two environments.

관련 오류

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. 라이선스 세부 정보 인용된 오류 메시지 텍스트의 권리는 해당 데이터베이스 공급업체에 있습니다.