Quoted argument
A value containing a space is one argument, and the byte count reflects it
SET greeting "hello world"
Type commands as you would in redis-cli and get the RESP bytes that go on the wire. Useful for writing a client, for building a test fixture, and for working out why a command with quotes is not doing what you expected.
Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.
The answer appears here
Paste on the left and press Encode. Nothing leaves this tab.
Nothing else to flag.
No formatting problems, and nothing the rules object to. Worth remembering what that covers: this reads the file you pasted, not the account or cluster it will be applied to.
No finding matches that filter.
Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.
A value containing a space is one argument, and the byte count reflects it
SET greeting "hello world"
The quoting mistake behind most wrong number of arguments errors
SET greeting "hello world
These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.
`SET k hello world` is four arguments and an error. redis-cli splits on whitespace outside quotes, which is where wrong number of arguments comes from.
Instead:Quote it: `SET k "hello world"`.
It cannot carry a value containing a space, a newline or a null byte, and it cannot express an empty argument. It exists for telnet, not for clients.
Instead:Send the array-of-bulk-strings form, which has none of those limits.
Whatever the reply will look like, the request is uniform: an array whose elements are the command name and its arguments, each as a length-prefixed bulk string. There is no separate syntax for different commands.
Redis does accept a plain whitespace-delimited line, which is how you can talk to it over telnet. No client uses it, because an inline command cannot carry a value containing a space, a newline or a null byte, and it has no way to express an empty argument. The array form has none of those limits.
SET k hello world is four arguments and an error; SET k "hello world" is three and works. redis-cli splits on whitespace outside quotes, honours single and double quotes, and processes backslash escapes inside double quotes only. Getting this wrong is the usual cause of a wrong number of arguments error.
Every command carries roughly fourteen bytes of framing plus the length prefix of each argument. For large values that is noise, but for a pipeline of small commands it is most of the traffic, which is the real argument for MSET over repeated SET and for pipelining over round trips.
set and SET are the same command. mykey and MyKey are two different keys. This bites hardest when a config file or an environment variable changes case somewhere in a deployment pipeline.
It does not validate the command. An unknown command, a wrong argument count for a real command, or a key of the wrong type all encode perfectly here and fail at the server. It also does not know your server version, so it cannot say whether a command exists yet.