ERR
RedisERRORCommonCommand ErrorHIGH confidence

Syntax error

Production Risk

Low. The server correctly rejects a malformed command.

What this means

This generic error indicates a command was sent that does not conform to the Redis protocol or a command's expected syntax. It's often caused by typos, unquoted strings with spaces, or malformed requests.

Why it happens
  1. 1A typo in a command name (e.g., 'GTE' instead of 'GET').
  2. 2A string argument containing spaces or special characters is not enclosed in quotes.
  3. 3Malformed command sent by a buggy client or manual telnet session.
How to reproduce

A user tries to set a key with a value containing a space, but forgets to quote the value.

trigger — this will error
trigger — this will error
SET mykey hello world

expected output

(error) ERR syntax error

Fix 1

Correct the command syntax

WHEN Upon receiving the error

Correct the command syntax
SET mykey "hello world"

Why this works

Ensuring all command names are correct and all string literals with spaces or special characters are properly quoted will resolve the error.

Fix 2

Use a Redis client library

WHEN Developing an application

Use a Redis client library
redis.set("mykey", "hello world");

Why this works

Client libraries handle the complexities of quoting and formatting, preventing most syntax errors automatically.

What not to do

Send binary or non-RESP formatted data to Redis

Redis expects commands formatted according to the RESP (REdis Serialization Protocol). Sending data in any other format will almost always result in a syntax error.

Sources
Official documentation ↗

RESP protocol parser

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Redis errors