// エラーリファレンス

Redis error codes

Redis does not use numbered error codes. Every failed command gets a single reply line that starts with an uppercase prefix such as WRONGTYPE, MOVED or OOM, followed by a human-readable message. The prefix is the stable part: match on it, not on the prose, which changes between Redis versions. Two families break the plain-message pattern: MOVED and ASK carry a hash slot and an endpoint (MOVED 12182 127.0.0.1:7002), and ERR is the generic prefix Redis puts in front of message-specific failures such as unknown command or wrong number of arguments. The pages below cover the prefixes that come up in day-to-day work, with the exact reply text and what to run next.

Reading a Redis error

The reply is one line: a dash, the uppercase prefix, then the message. The first token is the code. Match on the prefix in your error handling, because the wording after it is not stable across Redis versions.

MOVED and ASK embed routing data: the hash slot and the host:port that owns it. Cluster-aware clients follow them silently; plain redis-cli needs -c to do the same.

ERR is the catch-all prefix. The message after it names the real problem, such as unknown command, wrong number of arguments or invalid expire time, and each of those has its own page here.

Most drivers surface the whole reply line as the exception message, so the prefix arrives intact. Match on the prefix from that string rather than on driver-specific exception classes, which vary by library and language.

All Redis errors in this reference

24 codes, 24 with a full write-up (linked). Codes and messages are from the Redis documentation and source code.

Connection and auth

コード意味
NOAUTH Authentication required NOAUTH Authentication required.
WRONGPASS Password or username rejected WRONGPASS invalid username-password pair or user is disabled.
NOPERM The ACL user lacks permission NOPERM User default has no permissions to run the 'get' command

Cluster and replication

コード意味
READONLY Write rejected on a read only replica READONLY You can't write against a read only replica.
MASTERDOWN Stale data is not allowed to be served MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.
MOVED The key lives on another cluster node MOVED 12182 127.0.0.1:7002
ASK The key is migrating to another node ASK 12182 127.0.0.1:7002
CROSSSLOT Multi-key command spans two slots CROSSSLOT Keys in request don't hash to the same slot
CLUSTERDOWN The cluster cannot serve this slot CLUSTERDOWN The cluster is down
TRYAGAIN Slot is rehashing, retry the command TRYAGAIN Multiple keys request during rehashing of slot
NOREPLICAS Too few healthy replicas to write NOREPLICAS Not enough good replicas to write.

Data types and commands

コード意味
WRONGTYPE The key holds a different data type WRONGTYPE Operation against a key holding the wrong kind of value
ERR unknown command Redis does not know this command ERR unknown command 'HGETALLX', with args beginning with: 'myhash'
ERR wrong number of arguments Argument count is wrong ERR wrong number of arguments for 'get' command
NOSCRIPT Script SHA1 is not cached NOSCRIPT No matching script. Please use EVAL.
EXECABORT Transaction discarded after an error EXECABORT Transaction discarded because of previous errors.
BUSY Server is blocked by a long script BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.
ERR invalid expire time Expire value is out of range ERR invalid expire time in 'set' command

Memory and persistence

コード意味
OOM Memory limit reached OOM command not allowed when used memory > 'maxmemory'.
MISCONF Persistence is failing, writes stopped MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
LOADING Dataset still loading from disk LOADING Redis is loading the dataset in memory
BUSYKEY Target key already exists BUSYKEY Target key name already exists.

Streams and pub/sub

コード意味
BUSYGROUP Consumer group already exists BUSYGROUP Consumer Group name already exists
NOGROUP Consumer group does not exist NOGROUP No such key 'orders' or consumer group 'workers' in XREADGROUP with GROUP option
// 1 つのクライアント、すべてのエンジン

A faster way to work with Redis

SQLly は、macOS、Windows、Linux 向けのネイティブ SQL クライアントで、スキーマ対応の IntelliSense と、危険なステートメントへのガードレールを備えています。

このページのテキストとデータ: CC BY 4.0、出典は SQLly (sqlly.app) と明記してください。 コードと SQL スニペット: MIT. ライセンスの詳細 引用したエラーメッセージの文言は、各データベースベンダーに帰属します。