{
  "schema_version": 2,
  "id": "develop/reference/errors/common/err-not-an-integer",
  "title": "ERR value is not an integer or out of range",
  "url": "https://redis.io/docs/latest/develop/reference/errors/common/err-not-an-integer/",
  "summary": "A command requires a whole number, but the stored value or an argument is not a whole number.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-11-02T15:10:28+01:00",
  "page_type": "content",
  "content_hash": "c0ca14778e8b0bb61b4d57f3072413a301abe4767c157da7536977f0c23a2d0c",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Redis returns this error when a command needs a whole number but gets something else. The problem can be an argument you passed, or the value stored in the key.\n\n[code example]"
    },
    {
      "id": "example",
      "title": "Example",
      "role": "example",
      "text": "[`INCR`](https://redis.io/docs/latest/commands/incr) adds 1 to the number stored in a key, so it fails when the key holds text:\n\n[code example]\n\nAn argument that should be a number gives the same error:\n\n[code example]"
    },
    {
      "id": "how-to-fix-it",
      "title": "How to fix it",
      "role": "content",
      "text": "- **The key holds text or a decimal number.** `INCR`, `DECR`, `INCRBY`, and `DECRBY` only work on whole numbers, such as `10` or `-3`. A value such as `1.5` gives this error too. To add to a decimal number, use [`INCRBYFLOAT`](https://redis.io/docs/latest/commands/incrbyfloat).\n- **An argument isn't a whole number.** Arguments such as expiry times and counts must be whole numbers written as digits. Look for units or decimals, such as `10s` or `2.5`.\n- **The number is too large.** Redis stores these numbers as signed 64-bit integers, so the largest value is 9223372036854775807. When an increment would go past that, the error is `ERR increment or decrement would overflow`.\n\nCommands that take decimal numbers, such as `INCRBYFLOAT`, give a similar error when the value isn't a number: `ERR value is not a valid float`."
    }
  ],
  "examples": [
    {
      "id": "overview-ex0",
      "language": "plaintext",
      "code": "ERR value is not an integer or out of range",
      "section_id": "overview"
    },
    {
      "id": "example-ex0",
      "language": "plaintext",
      "code": "> SET counter \"abc\"\nOK\n> INCR counter\n(error) ERR value is not an integer or out of range",
      "section_id": "example"
    },
    {
      "id": "example-ex1",
      "language": "plaintext",
      "code": "> EXPIRE counter ten\n(error) ERR value is not an integer or out of range",
      "section_id": "example"
    }
  ]
}
