# Redis: (error) ERR wrong number of arguments for 'set' command / ERR syntax error

**Code:** `ERR wrong number of arguments / syntax error` · **Category:** Redis · **Seen on:** Redis, Node.js

The command was malformed: missing/extra arguments or an unsupported option for your Redis version.

## Meaning

Check the command's syntax with `COMMAND DOCS set` (Redis 7) or the docs. Client libraries may build commands incorrectly when a value is `undefined` (skipped) or when options (`EX`, `NX`, `GT`) aren't supported by the server version (e.g. `SET ... GET` needs 6.2, `GT/LT` for EXPIRE 7.0).

## Common causes

- Missing argument (undefined variable skipped)
- Option not supported by old server
- Wrong order of options
- Spaces unquoted in redis-cli
- Client/server version mismatch

## Quick fix

1. Run the command manually in `redis-cli`
2. Check `INFO server` version vs the command's "since" version
3. Quote values with spaces

## Detailed fix by platform

### Linux

1. `redis-cli COMMAND DOCS set | head; redis-cli INFO server | grep redis_version`

## How to diagnose

1. **Command** — Syntax per docs?
2. **Version** — Supported?
3. **Args** — All present?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/redis/err-syntax-error-or-wrong-number-of-arguments)
