apache/druid · error · org.apache.druid.java.util.common.IAE

Illegal bucketSize [ ], must be > 0

Error message

Illegal bucketSize [%s], must be > 0

What it means

Constructor-time argument validation in the 'buckets' post-aggregator: a BucketsPostAggregator was configured with a bucketSize that is zero or negative, so histogram buckets would have non-positive width. It fires at JSON-parsing/config-load time when the user-supplied bucketSize property is <= 0.

Solutions

  1. Set bucketSize to a positive value in the post-aggregator spec (e.g. "bucketSize": 0.5).
  2. Check query JSON for a typo such as a negative or omitted bucketSize that defaults to 0.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregator.java:56 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/7574b9df80e47e14. Report an issue: GitHub.

Appendix: source

Thrown at extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/BucketsPostAggregator.java:56

@JsonTypeName("buckets")
public class BucketsPostAggregator extends ApproximateHistogramPostAggregator
{
  private final float bucketSize;
  private final float offset;

  @JsonCreator
  public BucketsPostAggregator(
      @JsonProperty("name") String name,
      @JsonProperty("fieldName") String fieldName,
      @JsonProperty("bucketSize") float bucketSize,
      @JsonProperty("offset") float offset
  )
  {
    super(name, fieldName);
    this.bucketSize = bucketSize;
    if (this.bucketSize <= 0) {
      throw new IAE("Illegal bucketSize [%s], must be > 0", this.bucketSize);
    }
    this.offset = offset;
  }

  @Override
  public Set<String> getDependentFields()
  {
    return Sets.newHashSet(fieldName);
  }

  @Override
  public Object compute(Map<String, Object> values)
  {
    ApproximateHistogram ah = (ApproximateHistogram) values.get(fieldName);
    return ah.toHistogram(bucketSize, offset);
  }

  /**

View on GitHub (pinned to 9b90983fd2)