# Upstash REST 400 Bad Request

## What you see

HTTP 400. The body names the problem, for example
`{ "error": "ERR wrong number of arguments for 'get' command" }`.

## Causes

1. Malformed command path: wrong argument order or count versus the
   Redis protocol order. REST expects /COMMAND/arg1/arg2 in protocol
   order.
2. Unsupported command: blocking pops (BLPOP, BRPOP, BZPOPMAX,
   BZPOPMIN), blocking XREAD/XREADGROUP, CLUSTER commands,
   WATCH/UNWATCH/DISCARD.
3. Bad header combination: Upstash-Encoding base64 together with
   Upstash-Response-Format resp2 is rejected. Pick one.
4. Unknown Upstash-Response-Format value: only json and resp2 are
   allowed.
5. Unsupported HTTP method: only HEAD, GET, POST, PUT are allowed.
   Anything else is 405, but proxies sometimes rewrite methods.

## Confirm

Read the error field. It is specific:

- "ERR wrong number of arguments" points at your URL path.
- "unknown command" or similar points at an unsupported command.
- An empty or generic 400 with no error field points at headers.

## Fix

- Rebuild the path in Redis protocol order. Test the same command in
  redis-cli to confirm the argument order.
- For unsupported commands, check the REST compatibility table in the
docs and pick the supported alternative (non-blocking XREAD,
  /multi-exec instead of WATCH).
- Drop one of the two conflicting response headers.

## Verify

Re-run the exact curl. Expect HTTP 200 with a result field.