{
  "schema_version": 2,
  "id": "develop/reference/errors/common/err-syntax-error",
  "title": "ERR syntax error",
  "url": "https://redis.io/docs/latest/develop/reference/errors/common/err-syntax-error/",
  "summary": "A command's options are misspelled, in the wrong place, or can't be used together.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-11-02T15:10:28+01:00",
  "page_type": "content",
  "content_hash": "91d41be84294cdad033a8f3013f85112262855657baddcefc2920b93b0362f28",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Redis returns this error when it can't make sense of a command's options. The command name is right, but the options don't follow the command's syntax.\n\n[code example]"
    },
    {
      "id": "example",
      "title": "Example",
      "role": "example",
      "text": "The `NX` and `XX` options of [`SET`](https://redis.io/docs/latest/commands/set) can't be used together:\n\n[code example]"
    },
    {
      "id": "how-to-fix-it",
      "title": "How to fix it",
      "role": "content",
      "text": "The message doesn't say which option is wrong. Compare each option with the syntax on the command's page, and look for these common mistakes:\n\n- **Options that can't be used together,** such as `NX` and `XX` in `SET`.\n- **A misspelled option, or one your server doesn't support yet.** The history section of each command page lists the version that added each option.\n- **An option in the wrong place.** For example, in [`ZADD`](https://redis.io/docs/latest/commands/zadd), options such as `NX` go before the score and member. `ZADD myset NX 1 \"a\"` works, but `ZADD myset 1 \"a\" NX` gives this error.\n- **A value with spaces that isn't quoted.** In `redis-cli`, `SET greeting hello world` sends `world` as an extra option. Put quotes around the value: `SET greeting \"hello world\"`."
    }
  ],
  "examples": [
    {
      "id": "overview-ex0",
      "language": "plaintext",
      "code": "ERR syntax error",
      "section_id": "overview"
    },
    {
      "id": "example-ex0",
      "language": "plaintext",
      "code": "> SET mykey \"value\" NX XX\n(error) ERR syntax error",
      "section_id": "example"
    }
  ]
}
