# Probabilistic data type errors

```json metadata
{
  "schema_version": 2,
  "title": "Probabilistic data type errors",
  "description": "Every error message that probabilistic data type commands return in Redis 8.10",
  "categories": ["docs","develop","stack","oss","rs","rc","oss","kubernetes","clients"],
  "tableOfContents": {"sections":[{"id":"err","title":"ERR"},{"id":"wrongtype","title":"WRONGTYPE"},{"id":"cms","title":"CMS:"},{"id":"topk","title":"TopK:"},{"id":"messages-without-a-code","title":"Messages without a code"}]}

,
  "codeExamples": []
}
```


These are the error messages of the [probabilistic data types](https://redis.io/docs/latest/develop/data-types/probabilistic): Bloom filters, Cuckoo filters, count-min sketches, Top-K, and t-digest. Many start with `ERR`. Others start with the name of the data type, such as `CMS:` or `TopK:`, or have no code at all.

## ERR

Errors from Bloom filters, Cuckoo filters, and t-digest mostly start with the general prefix `ERR`. T-digest errors then say `T-Digest:`, as in `ERR T-Digest: error parsing compression parameter`. Most of these errors are about an argument that's invalid or out of range, such as the capacity or the error rate of a filter. Others say that an item already exists, that a key wasn't found, or that a filter that doesn't scale is full. To fix it, compare your command with the syntax on its command page, such as [`BF.RESERVE`](https://redis.io/docs/latest/commands/bf.reserve) or [`TDIGEST.CREATE`](https://redis.io/docs/latest/commands/tdigest.create).

This group also has the errors of `CONFIG SET` for these data types' configuration parameters, which start with `ERR CONFIG SET failed`.

| Error message | Explanation | Returned by |
|---|---|---|
| `ERR bad capacity` | The capacity argument of `BF.RESERVE`, the third one, isn't an integer. Pass the number of items you expect to add, as a whole number from 1 to 1073741824. | `BF.RESERVE` |
| `ERR bad error rate` | The error rate argument of `BF.RESERVE`, the one right after the key, isn't a number. Pass the false positive rate you accept as a decimal strictly between 0 and 1, such as `0.01`. | `BF.RESERVE` |
| `ERR bad expansion` | The value after `EXPANSION` in `BF.RESERVE` isn't an integer. Pass a whole number from 0 to 32768: each new sub-filter is this many times larger than the previous one, and 0 makes the filter non-scaling. | `BF.RESERVE` |
| `ERR capacity must be in the range [<min_capacity>, <max_capacity>]` | The capacity you passed to `BF.RESERVE` is outside the range in the message, 1 to 1073741824. Use a smaller capacity; a scaling filter adds sub-filters as it fills, so you don't need to reserve its final size up front. | `BF.RESERVE` |
| `` ERR CONFIG SET failed (possibly related to argument '<config_name>') - Invalid value for `<config_name>` `` | You set one of the probabilistic data type parameters, such as `bf-error-rate` or `cf-bucket-size`, to a value that isn't a number. `bf-error-rate` takes a decimal; the other `bf-` and `cf-` parameters take whole numbers. | `CONFIG SET` |
| `` ERR CONFIG SET failed (possibly related to argument '<config_name>') - Value for `<config_name>` must be in the range (<min>, <max>) `` | The value you set for `bf-error-rate` isn't strictly between 0 and 1; both limits are excluded. Use a false positive rate such as `0.01`; values above 0.25 are accepted but capped at 0.25. | `CONFIG SET` |
| `` ERR CONFIG SET failed (possibly related to argument '<config_name>') - Value for `<config_name>` must be in the range [<min>, <max>] `` | The value you set for the integer parameter named in the message is outside the range shown. The limits of `cf-initial-size` and `cf-bucket-size` depend on each other: the initial size must be at least twice the bucket size. | `CONFIG SET` |
| `ERR Could not create filter` | Redis couldn't build the Cuckoo filter because its capacity was smaller than twice the bucket size. The commands check this earlier, so you shouldn't normally see it; check the capacity and the `cf-bucket-size` and `cf-initial-size` parameters. | `CF.ADD`, `CF.ADDNX`, `CF.INSERT`, `CF.INSERTNX`, `CF.RESERVE` |
| `ERR could not create filter` | Redis couldn't build the Bloom filter because its capacity or error rate was invalid when it created it. The commands check both values earlier, so you shouldn't normally see it; check your values and the `bf-initial-size` and `bf-error-rate` parameters. | `BF.ADD`, `BF.INSERT`, `BF.MADD`, `BF.RESERVE` |
| `ERR error rate must be in the range (<min_error_rate>, <max_error_rate>)` | The error rate you passed to `BF.RESERVE` isn't strictly between 0 and 1; both limits are excluded. Use the false positive rate you accept, such as `0.01`; values above 0.25 are accepted but capped at 0.25. | `BF.RESERVE` |
| `ERR expansion must be in the range [<min_expansion>, <max_expansion>]` | The `EXPANSION` value of `BF.RESERVE` is negative or larger than 32768. Use a whole number in that range: each new sub-filter is this many times larger than the previous one, and the default is 2. | `BF.RESERVE` |
| `ERR Insufficient memory` | The Cuckoo filter was full and Redis couldn't allocate memory for a new sub-filter, so `CF.ADD` or `CF.ADDNX` didn't add the item. Free memory, or reserve a larger filter with `CF.RESERVE`. | `CF.ADD`, `CF.ADDNX`, `CF.INSERT`, `CF.INSERTNX` |
| `ERR Insufficient memory to create filter` | Redis couldn't allocate the memory for the new filter. A Bloom filter grows with its capacity and with a lower error rate, and a Cuckoo filter with its capacity; use a smaller capacity, or free memory on the server. | `BF.ADD`, `BF.INSERT`, `BF.MADD`, `BF.RESERVE`, `CF.ADD`, `CF.ADDNX`, `CF.INSERT`, `CF.INSERTNX`, `CF.RESERVE` |
| `ERR Insufficient memory to create topk data structure` | Redis couldn't allocate memory for the Top-K sketch, whose size grows with width times depth, plus `k` entries. Use a smaller width, depth, or `k` in `TOPK.RESERVE`. | `TOPK.RESERVE` |
| `ERR invalid chunk - Too big for current filter` | The data you passed to `BF.LOADCHUNK` is larger than the space left in the filter at that iterator, so it doesn't belong there. Load the header chunk first, then the other chunks with the iterators `BF.SCANDUMP` returned, unchanged. | `BF.LOADCHUNK` |
| `ERR invalid offset - no link found` | The iterator you passed to `BF.LOADCHUNK` points past the end of the filter, so Redis can't tell where the data belongs. Use the iterators that `BF.SCANDUMP` returned, and load the header chunk first so the filter has the right size. | `BF.LOADCHUNK` |
| `ERR item exists` | The key already holds a filter of the same type, so `BF.RESERVE` or `CF.RESERVE` can't create one there, and `CF.LOADCHUNK` can't load a header, iterator 1, into it. Delete the key or use another name. | `BF.RESERVE`, `CF.LOADCHUNK`, `CF.RESERVE` |
| `ERR no expansion` | `EXPANSION` is the last argument of `BF.RESERVE`, with no value after it. Add the expansion rate, a whole number from 0 to 32768, or remove the keyword. | `BF.RESERVE` |
| `ERR non scaling filter is full` | The Bloom filter is non-scaling, created with `NONSCALING` or an expansion of 0, and already holds as many items as its capacity. `BF.MADD` and `BF.INSERT` stop at this item; create a larger filter, or one that scales. | `BF.ADD`, `BF.INSERT`, `BF.MADD` |
| `ERR not found` | The key doesn't exist. Create the filter first, for example with `BF.RESERVE`, `CF.RESERVE`, or `BF.ADD`; with `NOCREATE`, `BF.INSERT` and `CF.INSERT` don't create it, and the `LOADCHUNK` commands need the header chunk first. | `BF.INFO`, `BF.INSERT`, `BF.LOADCHUNK`, `BF.SCANDUMP`, `CF.INFO`, `CF.INSERT`, `CF.INSERTNX`, `CF.LOADCHUNK`, `CF.SCANDUMP` |
| `ERR problem inserting into filter` | The Bloom filter was full and Redis couldn't add a new, larger sub-filter to it, usually because it couldn't allocate the memory. The error replaces that item's result; free memory, or reserve a larger capacity so the filter needs fewer expansions. | `BF.ADD`, `BF.INSERT`, `BF.MADD` |
| `ERR received bad data` | The data you passed to `BF.LOADCHUNK` isn't a valid chunk for that iterator, for example a header that doesn't describe a valid filter. Pass the iterator and data pairs exactly as `BF.SCANDUMP` returned them, header first, as unchanged binary data. | `BF.LOADCHUNK` |
| `ERR Second argument must be numeric` | The iterator argument of `BF.LOADCHUNK`, right after the key, isn't an integer. Pass the iterator exactly as `BF.SCANDUMP` returned it together with the data chunk. | `BF.LOADCHUNK` |
| `ERR T-Digest: allocation failed` | Redis couldn't allocate memory for the t-digest, usually because the `COMPRESSION` value is very large, since memory grows with compression. Use a smaller value; the default is 100. | `TDIGEST.CREATE` |
| `ERR T-Digest: allocation of destination digest failed` | Redis couldn't allocate memory for the merged t-digest, usually because its compression is very large. Without `COMPRESSION`, the merge uses the destination's compression or the largest one among the sources; pass a smaller `COMPRESSION` value. | `TDIGEST.MERGE` |
| `ERR T-Digest: compression parameter needs to be a positive integer` | The `COMPRESSION` value of `TDIGEST.CREATE` or `TDIGEST.MERGE` is 0 or negative. Pass a positive whole number; the default is 100, and higher values give more accurate results but use more memory. | `TDIGEST.CREATE`, `TDIGEST.MERGE` |
| `ERR T-Digest: error parsing cdf` | One of the values you passed to `TDIGEST.CDF` isn't a number. Pass each value whose cumulative fraction you want as a number, such as `10` or `2.5`. | `TDIGEST.CDF` |
| `ERR T-Digest: error parsing compression parameter` | The value after `COMPRESSION` in `TDIGEST.CREATE` or `TDIGEST.MERGE` isn't an integer. Pass a positive whole number, for example `COMPRESSION 100`. | `TDIGEST.CREATE`, `TDIGEST.MERGE` |
| `ERR T-Digest: error parsing high_cut_percentile` | The high cut percentile, the last argument of `TDIGEST.TRIMMED_MEAN`, isn't a number. Pass a fraction from 0 to 1 that's higher than the low cut, such as `0.9`. | `TDIGEST.TRIMMED_MEAN` |
| `ERR T-Digest: error parsing low_cut_percentile` | The low cut percentile, the argument after the key in `TDIGEST.TRIMMED_MEAN`, isn't a number. Pass a fraction from 0 to 1 that's lower than the high cut, such as `0.1`. | `TDIGEST.TRIMMED_MEAN` |
| `ERR T-Digest: error parsing numkeys` | The `numkeys` argument of `TDIGEST.MERGE`, right after the destination key, isn't an integer. Pass the number of source keys that follow, as in `TDIGEST.MERGE dest 2 src1 src2`. | `TDIGEST.MERGE` |
| `ERR T-Digest: error parsing quantile` | One of the values you passed to `TDIGEST.QUANTILE` isn't a number. Pass each quantile as a fraction from 0 to 1, such as `0.5` for the median. | `TDIGEST.QUANTILE` |
| `ERR T-Digest: error parsing rank` | One of the ranks you passed to `TDIGEST.BYRANK` or `TDIGEST.BYREVRANK` isn't an integer. Pass each rank as a whole number of 0 or more; rank 0 is the smallest observation, or the largest with `TDIGEST.BYREVRANK`. | `TDIGEST.BYRANK`, `TDIGEST.BYREVRANK` |
| `ERR T-Digest: error parsing val parameter` | One of the values you passed to `TDIGEST.ADD` isn't a number, or is `NaN`. Pass each observation as a finite number; when one value is invalid, Redis adds none of them. | `TDIGEST.ADD` |
| `ERR T-Digest: error parsing value` | One of the values you passed to `TDIGEST.RANK` or `TDIGEST.REVRANK` isn't a number, or is `NaN`. Pass each value whose rank you want as a number, such as `10` or `2.5`. | `TDIGEST.RANK`, `TDIGEST.REVRANK` |
| `ERR T-Digest: error setting value` | Redis built the t-digest but couldn't store it in the key. The command opens the key for writing first, so you shouldn't normally see this; retry the command, and check the server log if it happens again. | `TDIGEST.CREATE`, `TDIGEST.MERGE` |
| `ERR T-Digest: key already exists` | The key already holds a t-digest, so `TDIGEST.CREATE` can't create one there. Use another key name, delete the key first, or empty the existing t-digest with `TDIGEST.RESET`. | `TDIGEST.CREATE` |
| `ERR T-Digest: key does not exist` | The t-digest key doesn't exist. Create it first with `TDIGEST.CREATE`; for `TDIGEST.MERGE`, every source key must exist, although Redis creates the destination for you. | `TDIGEST.ADD`, `TDIGEST.BYRANK`, `TDIGEST.BYREVRANK`, `TDIGEST.CDF`, `TDIGEST.INFO`, `TDIGEST.MAX`, `TDIGEST.MERGE`, `TDIGEST.MIN`, `TDIGEST.QUANTILE`, `TDIGEST.RANK`, `TDIGEST.RESET`, `TDIGEST.REVRANK`, `TDIGEST.TRIMMED_MEAN` |
| `ERR T-Digest: low_cut_percentile and high_cut_percentile should be in [0,1]` | One of the cut percentiles you passed to `TDIGEST.TRIMMED_MEAN` is below 0 or above 1. Pass both as fractions of the data, such as `0.1` and `0.9` to leave out the lowest and highest 10 percent. | `TDIGEST.TRIMMED_MEAN` |
| `ERR T-Digest: low_cut_percentile should be lower than high_cut_percentile` | The low cut percentile of `TDIGEST.TRIMMED_MEAN` is equal to or higher than the high cut percentile. Put the lower fraction first, as in `TDIGEST.TRIMMED_MEAN key 0.1 0.9`. | `TDIGEST.TRIMMED_MEAN` |
| `ERR T-Digest: numkeys needs to be a positive integer` | The `numkeys` argument of `TDIGEST.MERGE` is 0 or negative. Pass the number of source keys that follow it, which must be at least 1. | `TDIGEST.MERGE` |
| `ERR T-Digest: overflow detected` | The t-digest library found that adding or merging the data would overflow its internal counts, so the command failed. This can happen when digests hold an extremely large number of observations, for example after a key is merged into itself many times. | `TDIGEST.ADD`, `TDIGEST.MERGE` |
| `ERR T-Digest: quantile should be in [0,1]` | One of the quantiles you passed to `TDIGEST.QUANTILE` is below 0 or above 1. Pass each quantile as a fraction, such as `0.5` for the median or `0.99` for the 99th percentile. | `TDIGEST.QUANTILE` |
| `ERR T-Digest: rank needs to be non negative` | One of the ranks you passed to `TDIGEST.BYRANK` or `TDIGEST.BYREVRANK` is negative. Pass ranks of 0 or more; rank 0 is the smallest observation, or the largest with `TDIGEST.BYREVRANK`. | `TDIGEST.BYRANK`, `TDIGEST.BYREVRANK` |
| `ERR T-Digest: val parameter needs to be a finite number` | One of the values you passed to `TDIGEST.ADD` is infinite, such as `inf` or `-inf`. Pass finite numbers only; when one value is invalid, Redis adds none of them. | `TDIGEST.ADD` |
| `ERR T-Digest: wrong keyword` | The command got an option it doesn't know. After the key, `TDIGEST.CREATE` accepts only `COMPRESSION` and its value; after the source keys, `TDIGEST.MERGE` accepts `COMPRESSION` and `OVERRIDE`, so a `numkeys` smaller than the number of sources also causes this. | `TDIGEST.CREATE`, `TDIGEST.MERGE` |
| `ERR wrong number of arguments for '<command>' command` | You called the command in the message with too many or too few arguments. Check its syntax; a common cause is an option without its value, such as `CAPACITY` with no number, or `ITEMS` with no items after it. [How to fix it](https://redis.io/docs/latest/develop/reference/errors/common/err-wrong-number-of-arguments/#how-to-fix-it) | `BF.ADD`, `BF.CARD`, `BF.EXISTS`, `BF.INFO`, `BF.INSERT`, `BF.LOADCHUNK`, `BF.MADD`, `BF.MEXISTS`, `BF.RESERVE`, `BF.SCANDUMP`, `CF.ADD`, `CF.ADDNX`, `CF.COMPACT`, `CF.COUNT`, `CF.DEL`, `CF.EXISTS`, `CF.INFO`, `CF.INSERT`, `CF.INSERTNX`, `CF.LOADCHUNK`, `CF.MEXISTS`, `CF.RESERVE`, `CF.SCANDUMP`, `CMS.INCRBY`, `CMS.INFO`, `CMS.INITBYDIM`, `CMS.INITBYPROB`, `CMS.MERGE`, `CMS.QUERY`, `TDIGEST.ADD`, `TDIGEST.BYRANK`, `TDIGEST.BYREVRANK`, `TDIGEST.CDF`, `TDIGEST.CREATE`, `TDIGEST.INFO`, `TDIGEST.MAX`, `TDIGEST.MERGE`, `TDIGEST.MIN`, `TDIGEST.QUANTILE`, `TDIGEST.RANK`, `TDIGEST.RESET`, `TDIGEST.REVRANK`, `TDIGEST.TRIMMED_MEAN`, `TOPK.ADD`, `TOPK.COUNT`, `TOPK.INCRBY`, `TOPK.INFO`, `TOPK.LIST`, `TOPK.QUERY`, `TOPK.RESERVE` |


## WRONGTYPE

The key holds a different data type than the command works with. For example, you used a Bloom filter command on a key that holds a Cuckoo filter. See [`WRONGTYPE`](https://redis.io/docs/latest/develop/reference/errors/common/wrongtype).

| Error message | Explanation | Returned by |
|---|---|---|
| `WRONGTYPE Operation against a key holding the wrong kind of value` | The key holds a different data type from the one the command works on, for example a Cuckoo filter passed to a `BF.` command. Use a key of the right type; `TYPE` shows what a key holds. [How to fix it](https://redis.io/docs/latest/develop/reference/errors/common/wrongtype/#how-to-fix-it) | `BF.ADD`, `BF.CARD`, `BF.INFO`, `BF.INSERT`, `BF.LOADCHUNK`, `BF.MADD`, `BF.RESERVE`, `BF.SCANDUMP`, `CF.ADD`, `CF.ADDNX`, `CF.INFO`, `CF.INSERT`, `CF.INSERTNX`, `CF.LOADCHUNK`, `CF.RESERVE`, `CF.SCANDUMP`, `CMS.INCRBY`, `CMS.INFO`, `CMS.MERGE`, `CMS.QUERY`, `TDIGEST.ADD`, `TDIGEST.BYRANK`, `TDIGEST.BYREVRANK`, `TDIGEST.CDF`, `TDIGEST.CREATE`, `TDIGEST.INFO`, `TDIGEST.MAX`, `TDIGEST.MERGE`, `TDIGEST.MIN`, `TDIGEST.QUANTILE`, `TDIGEST.RANK`, `TDIGEST.RESET`, `TDIGEST.REVRANK`, `TDIGEST.TRIMMED_MEAN`, `TOPK.ADD`, `TOPK.COUNT`, `TOPK.INCRBY`, `TOPK.INFO`, `TOPK.LIST`, `TOPK.QUERY` |


## CMS:

Count-min sketch commands, such as `CMS.INITBYDIM` and `CMS.INCRBY`, start their errors with `CMS:`. Most of them say which argument is invalid, such as the width, the depth, or a number that can't be negative. To fix it, check that argument against the syntax on the command's page, such as [`CMS.INITBYDIM`](https://redis.io/docs/latest/commands/cms.initbydim).

| Error message | Explanation | Returned by |
|---|---|---|
| `CMS: Cannot parse number` | One of the increments you passed to `CMS.INCRBY` isn't an integer, so Redis doesn't apply any of them. Follow each item with a whole-number increment, as in `CMS.INCRBY key item1 5 item2 1`. | `CMS.INCRBY` |
| `CMS: INCRBY overflow` | An item's counter reached 4294967295, the most a count-min sketch counter can hold, and it stays there, so later increments of that item fail too. The error replaces that item's count in the reply; other items are still counted. | `CMS.INCRBY` |
| `CMS: Insufficient memory to create the key` | Redis couldn't allocate memory for a count-min sketch of the requested size, which needs 4 bytes for each counter, width times depth. Use a smaller width and depth, or, with `CMS.INITBYPROB`, a larger error and probability. | `CMS.INITBYDIM`, `CMS.INITBYPROB` |
| `CMS: invalid depth` | The depth you passed to `CMS.INITBYDIM`, its last argument, isn't an integer of 1 or more. Pass a positive whole number of rows, as in `CMS.INITBYDIM key 2000 5`. | `CMS.INITBYDIM`, `CMS.INITBYPROB` |
| `CMS: invalid init arguments` | The width and depth of the sketch are too large: their product doesn't fit in a 64-bit integer. With `CMS.INITBYPROB`, a very small error value produces a huge width; use smaller dimensions or a larger error. | `CMS.INITBYDIM`, `CMS.INITBYPROB` |
| `CMS: invalid numkeys` | The `numKeys` argument of `CMS.MERGE`, right after the destination key, isn't an integer. Pass the number of source sketches that follow, as in `CMS.MERGE dest 2 src1 src2`. | `CMS.MERGE` |
| `CMS: invalid overestimation value` | The error argument of `CMS.INITBYPROB` isn't a number strictly between 0 and 1. Pass the overestimate you accept, as a fraction of the total count, for example `0.001`. | `CMS.INITBYDIM`, `CMS.INITBYPROB` |
| `CMS: invalid prob value` | The probability argument of `CMS.INITBYPROB`, its last one, isn't a number strictly between 0 and 1. Pass the probability of an overestimate that you accept, for example `0.01`. | `CMS.INITBYDIM`, `CMS.INITBYPROB` |
| `CMS: invalid weight value` | One of the values after `WEIGHTS` in `CMS.MERGE` isn't an integer. Give one whole-number weight for each source sketch, in the same order as the sources. | `CMS.MERGE` |
| `CMS: invalid width` | The width you passed to `CMS.INITBYDIM`, right after the key, isn't an integer of 1 or more. Pass a positive whole number of counters per row, as in `CMS.INITBYDIM key 2000 5`. | `CMS.INITBYDIM`, `CMS.INITBYPROB` |
| `CMS: key already exists` | The key you passed to `CMS.INITBYDIM` or `CMS.INITBYPROB` already exists, whatever data type it holds, not only when it's a sketch. Use a new key name, or delete the existing key first. | `CMS.INITBYDIM`, `CMS.INITBYPROB` |
| `CMS: key does not exist` | The count-min sketch key doesn't exist. Create it first with `CMS.INITBYDIM` or `CMS.INITBYPROB`; for `CMS.MERGE`, the destination and every source key must already exist. | `CMS.INCRBY`, `CMS.INFO`, `CMS.MERGE`, `CMS.QUERY` |
| `CMS: MERGE overflow` | The merge would make a counter negative or larger than 4294967295, the most a counter can hold, so `CMS.MERGE` changed nothing. This usually comes from a negative weight or very large weights; use smaller, positive weights. | `CMS.MERGE` |
| `CMS: Number cannot be negative` | One of the increments you passed to `CMS.INCRBY` is negative, so Redis doesn't apply any of them. A count-min sketch only counts up, so use 0 or a positive integer. | `CMS.INCRBY` |
| `CMS: Number of keys must be positive` | The `numKeys` argument of `CMS.MERGE` is 0 or negative. Pass the number of source sketches you merge, which must be at least 1. | `CMS.MERGE` |
| `CMS: width/depth is not equal` | One of the source sketches in `CMS.MERGE` has a different width or depth from the destination. You can only merge sketches with the same dimensions, so create the destination with the same width and depth as the sources. | `CMS.MERGE` |
| `CMS: wrong number of keys` | The number of source keys after `numKeys` in `CMS.MERGE` doesn't match `numKeys`. List exactly that many source keys, or change `numKeys`; if you pass weights, start them with the `WEIGHTS` keyword. | `CMS.MERGE` |
| `CMS: wrong number of keys/weights` | In `CMS.MERGE` with `WEIGHTS`, the number of source keys before `WEIGHTS` or the number of weights after it doesn't match `numKeys`. Give exactly `numKeys` sources and the same number of weights. | `CMS.MERGE` |


## TopK:

Top-K commands, such as `TOPK.RESERVE` and `TOPK.ADD`, start their errors with `TopK:`. Most of them are about an invalid argument of [`TOPK.RESERVE`](https://redis.io/docs/latest/commands/topk.reserve), such as `k`, the width, or the decay. Others say that the key already exists or doesn't exist.

| Error message | Explanation | Returned by |
|---|---|---|
| `TopK: increment must be an integer greater or equal to 0                            and smaller or equal to 100,000` | An increment you passed to `TOPK.INCRBY` isn't an integer from 0 to 100000. Redis counts the items before it, then stops with a reply that's missing elements, so your client can hang or misread the next reply; use valid increments. | `TOPK.INCRBY` |
| `TopK: invalid decay value. must be '<= 1' & '> 0'` | The decay argument of `TOPK.RESERVE`, its last one, isn't a number greater than 0 and at most 1. Use a value such as the default, `0.9`. | `TOPK.RESERVE` |
| `TopK: invalid depth` | The depth argument of `TOPK.RESERVE` isn't an integer from 1 to 4294967295. Pass a positive whole number, as in `TOPK.RESERVE key 10 50 4 0.9`, or leave out width, depth, and decay to use the defaults. | `TOPK.RESERVE` |
| `TopK: invalid k` | The `k` argument of `TOPK.RESERVE`, the number of top items to keep, isn't an integer from 1 to 4294967295. Pass a positive whole number, as in `TOPK.RESERVE key 10`. | `TOPK.RESERVE` |
| `TopK: invalid width` | The width argument of `TOPK.RESERVE` isn't an integer from 1 to 4294967295. Pass a positive whole number of counters per row; give width, depth, and decay together, or none of them. | `TOPK.RESERVE` |
| `TopK: key already exists` | The key you passed to `TOPK.RESERVE` already exists, whatever data type it holds, not only when it's a Top-K sketch. Use a new key name, or delete the existing key first. | `TOPK.RESERVE` |
| `TopK: key does not exist` | The Top-K key doesn't exist. Create it first with `TOPK.RESERVE`; Top-K commands don't create the key for you. | `TOPK.ADD`, `TOPK.COUNT`, `TOPK.INCRBY`, `TOPK.INFO`, `TOPK.LIST`, `TOPK.QUERY` |


## Messages without a code

Some errors, mostly from Cuckoo filters, have no code, such as `Bad capacity` or `Couldn't parse EXPANSION`. Client libraries and the error statistics of [`INFO errorstats`](https://redis.io/docs/latest/commands/info) treat the first word of the message as the code. Most of these errors are about the arguments of `CF.RESERVE` and `CF.INSERT`. To fix it, check the arguments against the syntax on [`CF.RESERVE`](https://redis.io/docs/latest/commands/cf.reserve).

| Error message | Explanation | Returned by |
|---|---|---|
| `Bad capacity` | The capacity isn't a valid integer, or, for `BF.INSERT`, it's outside the range 1 to 1073741824. Pass a whole number as the `CAPACITY` value of `BF.INSERT` or `CF.INSERT`, or as the capacity argument of `CF.RESERVE`. | `BF.INSERT`, `CF.INSERT`, `CF.INSERTNX`, `CF.RESERVE` |
| `Bad error rate` | The `ERROR` value of `BF.INSERT` isn't a number, or isn't strictly between 0 and 1. Use the false positive rate you accept, such as `0.01`; values above 0.25 are accepted but capped at 0.25. | `BF.INSERT` |
| `Bad expansion` | The `EXPANSION` value of `BF.INSERT` isn't an integer, or is outside the range 0 to 32768. Use a whole number in that range; 0 makes the filter non-scaling, like `NONSCALING`. | `BF.INSERT` |
| `BUCKETSIZE: value must be in the range [<min_bucket_size>, <max_bucket_size>]` | The `BUCKETSIZE` value of `CF.RESERVE` is outside the range in the message, which is 1 to 255 by default. Pick a bucket size in that range; if `cf-initial-size` is set below 510, the maximum is half of it. | `CF.RESERVE` |
| `Capacity must be in the range [2 * BUCKETSIZE, <max_capacity>]` | The capacity you passed to `CF.RESERVE` is smaller than twice the bucket size, or larger than 1073741824. With the default bucket size of 2, the capacity must be at least 4; raise the capacity or lower `BUCKETSIZE`. | `CF.RESERVE` |
| `Capacity must be in the range [cf-bucket-size * 2, <max_capacity>]` | The `CAPACITY` value of `CF.INSERT` or `CF.INSERTNX` is smaller than twice the `cf-bucket-size` parameter, or larger than 1073741824. With the default bucket size of 2, use at least 4; to choose another bucket size, create the filter with `CF.RESERVE` first. | `CF.INSERT`, `CF.INSERTNX` |
| `Couldn't create filter!` | `CF.LOADCHUNK` couldn't rebuild the Cuckoo filter from the header chunk, iterator 1: its settings, such as the bucket size or expansion, are outside this server's allowed ranges, or memory ran out. Pass the first chunk exactly as `CF.SCANDUMP` returned it. | `CF.LOADCHUNK` |
| `Couldn't load chunk!` | `CF.LOADCHUNK` couldn't place the data: the iterator and data don't match a position inside the filter, or the data is empty. Load the header chunk first, then the other chunks with the iterators `CF.SCANDUMP` returned, unchanged. | `CF.LOADCHUNK` |
| `Couldn't parse BUCKETSIZE` | The value after `BUCKETSIZE` in `CF.RESERVE` isn't an integer, or it's missing. Pass a whole number of items per bucket, from 1 to 255, as in `CF.RESERVE key 1000 BUCKETSIZE 4`. | `CF.RESERVE` |
| `Couldn't parse EXPANSION` | The value after `EXPANSION` in `CF.RESERVE` isn't an integer, or it's missing. Pass a whole number from 0 to 32768; 0 means the filter never grows. | `CF.RESERVE` |
| `Couldn't parse MAXITERATIONS` | The value after `MAXITERATIONS` in `CF.RESERVE` isn't an integer, or it's missing. Pass a whole number from 1 to 65535: how many times Redis swaps items between buckets before it treats the filter as full. | `CF.RESERVE` |
| `Cuckoo filter was not found` | The key you passed to `CF.COMPACT` doesn't exist or doesn't hold a Cuckoo filter; this command reports a key of another type this way too. Check the key name and its type. | `CF.COMPACT` |
| `EXPANSION: value must be in the range [<min_expansion>, <max_expansion>]` | The `EXPANSION` value of `CF.RESERVE` is negative or larger than 32768. Use a whole number in that range: each new sub-filter is this many times larger than the last, and 0 means the filter never grows. | `CF.RESERVE` |
| `Filter is full` | The Cuckoo filter has no room for the item and can't grow, because its expansion is 0. Create a filter with a larger capacity or a nonzero `EXPANSION`; `CF.INSERT` reports a full filter as -1 for that item instead. | `CF.ADD`, `CF.ADDNX`, `CF.INSERT`, `CF.INSERTNX` |
| `Invalid header` | The data you passed to `CF.LOADCHUNK` with iterator 1 doesn't have the size of a Cuckoo filter header. Pass the first chunk exactly as `CF.SCANDUMP` returned it, as unchanged binary data. | `CF.LOADCHUNK` |
| `Invalid information value` | The optional argument of `BF.INFO` isn't one it knows. Use one of `CAPACITY`, `SIZE`, `FILTERS`, `ITEMS`, or `EXPANSION`, or leave it out to get all of them. | `BF.INFO` |
| `Invalid position` | The iterator you passed isn't valid: for `CF.SCANDUMP` it must be an integer of 0 or more, and for `CF.LOADCHUNK` an integer other than 0. Start `CF.SCANDUMP` at 0, then pass back the iterator each reply returns. | `CF.LOADCHUNK`, `CF.SCANDUMP` |
| `Maximum expansions reached` | The Cuckoo filter already has the maximum number of sub-filters, set by `cf-max-expansions` (32 by default), so Redis adds no more items to it. Create a filter with a larger capacity, or raise `cf-max-expansions` with `CONFIG SET`. | `CF.ADD`, `CF.ADDNX`, `CF.INSERT`, `CF.INSERTNX` |
| `MAXITERATIONS: value must be in the range [<min_iterations>, <max_iterations>]` | The `MAXITERATIONS` value of `CF.RESERVE` is outside the range 1 to 65535. Use a whole number in that range; the default is 20. | `CF.RESERVE` |
| `Nonscaling filters cannot expand` | You passed both `NONSCALING` and a nonzero `EXPANSION` to `BF.RESERVE`, which contradict each other. Remove one of them; this also happens when `bf-expansion-factor` is 0, which makes new filters non-scaling by default. | `BF.RESERVE` |
| `Not found` | The key you passed to `CF.DEL` doesn't exist or doesn't hold a Cuckoo filter; this command reports a key of another type this way too. If the key exists but the item isn't in it, `CF.DEL` returns 0 instead. | `CF.DEL` |
| `Second argument must be numeric` | The iterator argument of `BF.SCANDUMP`, right after the key, isn't an integer. Start with 0, then pass back the iterator that each reply returns until it returns 0. | `BF.SCANDUMP` |
| `Unknown argument received` | `BF.INSERT` or `CF.INSERT` found an argument before `ITEMS` that isn't one of its options. Put the items after `ITEMS`; `CF.INSERT` accepts `CAPACITY` and `NOCREATE`, and `BF.INSERT` also accepts `ERROR`, `EXPANSION`, and `NONSCALING`. | `BF.INSERT`, `CF.INSERT`, `CF.INSERTNX` |
| `WITHCOUNT keyword expected` | The argument after the key in `TOPK.LIST` isn't `WITHCOUNT`, the only option it takes. Pass `WITHCOUNT` to get each item's count as well, or leave the argument out. | `TOPK.LIST` |


