> ## 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.

# Too Many Histograms

> The configuration enables histogram on more primitive leaves than the platform allows

## Error message

```
Configuration contains {actual} histogram leaves, which exceeds the maximum of {max}
```

Example: `Configuration contains 78 histogram leaves, which exceeds the maximum of 64`

## When this error occurs

The platform caps the total number of histogram-enabled primitive columns at **64** per configuration. This limit applies across **both** the dataset and Rosetta Stone namespaces combined.

Every primitive leaf (string, integer, float, boolean, timestamp) that resolves to having the `histogram` stat enabled counts toward this limit. Object and array columns themselves do not count — only their primitive children do.

This error is raised before saving the configuration, so no resources are wasted on an overly broad histogram setup.

### Common causes

1. **Broad defaults with `histogram` enabled** — if defaults include `histogram` and the dataset has many columns, every compatible column gets a histogram automatically.
2. **Large nested objects** — an object with many primitive properties, each inheriting `histogram` from defaults or scope, can quickly exhaust the limit.
3. **Both namespaces enabled** — histograms on dataset columns plus Rosetta Stone attributes add up.

## Example: request that triggers this error

Given a dataset with 50 primitive columns and 20 Rosetta Stone attributes (all primitive):

```json theme={null}
{
  "defaults": {
    "enabled_stats": ["value_count", "null_value_count", "histogram"]
  },
  "refresh": { "trigger": "manual" }
}
```

This enables histogram on all 70 primitive leaves (50 dataset + 20 Rosetta Stone), exceeding the limit of 64.

## How to fix

Reduce the number of histogram-enabled leaves below 64. Several strategies:

### Option A: Remove histogram from defaults, enable per-field

Move histogram out of defaults and enable it only on the fields that matter:

```json theme={null}
{
  "defaults": {
    "enabled_stats": ["value_count", "null_value_count"]
  },
  "refresh": { "trigger": "manual" },
  "dataset": {
    "fields": [
      {
        "field_name": "price",
        "enabled_stats": ["value_count", "null_value_count", "histogram"]
      },
      {
        "field_name": "age",
        "enabled_stats": ["value_count", "null_value_count", "histogram"]
      }
    ]
  }
}
```

### Option B: Keep histogram in defaults, disable for one namespace

If you want histograms on dataset columns but not Rosetta Stone attributes:

```json theme={null}
{
  "defaults": {
    "enabled_stats": ["value_count", "null_value_count", "histogram"]
  },
  "refresh": { "trigger": "manual" },
  "rosetta_stone": {
    "scope": {
      "enabled_stats": ["value_count", "null_value_count"]
    }
  }
}
```

The Rosetta Stone scope replaces the inherited stat set with one that excludes `histogram`.

### Option C: Disable histogram on specific high-cardinality fields

Override individual fields to drop histogram while keeping defaults broad:

```json theme={null}
{
  "defaults": {
    "enabled_stats": ["value_count", "null_value_count", "histogram"]
  },
  "refresh": { "trigger": "manual" },
  "dataset": {
    "fields": [
      {
        "field_name": "raw_payload",
        "enabled_stats": ["value_count", "null_value_count"]
      },
      {
        "field_name": "metadata",
        "self": {
          "enabled_stats": ["null_value_count"]
        }
      }
    ]
  }
}
```

Fields listed with `enabled_stats` that exclude `histogram` no longer count toward the limit. Unlisted fields still inherit from defaults.

## Counting rules

* Only **primitive** types count: `StringType`, `LongType`, `DoubleType`, `BooleanType`, `TimestampTzType`
* **Array items** are excluded from the count (they are filtered at execution time)
* **Object** and **array** columns themselves do not count — only their primitive children
* The count spans both the `dataset` and `rosetta_stone` namespaces

## Related errors

* [Histogram Options Without Histogram Enabled](/reference/architecture/dataset-statistics/errors/histogram-options-without-stat) — histogram options present but stat not enabled
* [Invalid Histogram Bin Count](/reference/architecture/dataset-statistics/errors/invalid-max-bins) — max\_bins value out of range
