Skip to main content
-

Simple Error

RESP2

prefix: -  ·  client type: Exception / Error / exception class

Simple errors use the - prefix to signal command failures. The first word in upper case is the error code; the remainder is the human-readable message. Common codes: ERR (generic), WRONGTYPE (type mismatch), NOAUTH (authentication required), NOPERM (ACL permission denied).

Details

Simple errors have the format -<CODE> <message>\r\n. The error code is the first space-separated uppercase word; it allows clients to distinguish error categories without parsing the message string.

Common error codes: ERR – generic error WRONGTYPE – operation on wrong data type (e.g., LPUSH on a string key) NOAUTH – authentication required but not provided NOPERM – ACL permission denied LOADING – server is loading the dataset from disk BUSY – server is processing a slow script BUSYKEY – key already exists (CREATE with NX)

In RESP3 the equivalent is the blob error type (!) which supports binary-safe error messages. Simple errors remain valid in both RESP2 and RESP3.

Wire encoding

Wire bytes (CRLF shown as \\r\\n)
-ERR wrong number of arguments for 'get' command\r\n
-WRONGTYPE Operation against a key holding the wrong kind of value\r\n
-NOAUTH Authentication required.\r\n

Type information

Prefix byte-
VersionRESP2
Client typeException / Error / exception class
SpecificationRESP3 specification (GitHub) →

Redis commands returning this type

Any command that fails

See Also