> ## Documentation Index
> Fetch the complete documentation index at: https://docs.narrative.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Invalid Histogram Bin Count

> The max_bins value for histogram options is outside the allowed range [2, 100000]

## Error message

```
{context}: max_bins must be between 2 and 100000, got {value}
```

Example: `defaults: max_bins must be between 2 and 100000, got 1`

## When this error occurs

The `max_bins` parameter in histogram options controls how many bins the frequency distribution uses. It must be an integer between 2 and 100,000 (inclusive). This error is raised when the value falls outside that range.

## Example: request that triggers this error

```json theme={null}
{
  "defaults": {
    "enabled_stats": ["histogram"],
    "stat_options": {
      "histogram": { "max_bins": 1 }
    }
  },
  "refresh": { "trigger": "manual" }
}
```

A histogram with fewer than 2 bins is meaningless.

## How to fix

Set `max_bins` to a value between 2 and 100,000. If omitted, the server defaults to 50:

```json theme={null}
{
  "defaults": {
    "enabled_stats": ["histogram"],
    "stat_options": {
      "histogram": { "max_bins": 200 }
    }
  },
  "refresh": { "trigger": "manual" }
}
```

Common values:

* **50** (default) — good for most columns
* **200–1000** — useful for high-cardinality categorical columns
* **100,000** — maximum, for very granular distributions
