apache/druid · error · IllegalStateException
Value of Infinite is not allowed!
Error message
Value of Infinite is not allowed!
What it means
ServiceMetricEvent.Builder.setMetric also rejects infinite values (Double.isInfinite) with ISE. Infinite values (from overflow or division by zero) cannot be aggregated correctly downstream, so the builder throws rather than propagating them into the metrics pipeline.
Solutions
- Guard the arithmetic: check denominators, cap/round values, or use long arithmetic before converting to double.
- Sanitize before emitting: skip or clamp infinite values to a configured max.
- Fix the upstream counter/calculation that overflows.
- Log the offending metric name and value so the source computation can be fixed.
Example fix
// before
double rate = processed / elapsedSeconds; // elapsedSeconds == 0.0 -> Infinity
builder.setMetric("ingest/rate", rate); // ISE
// after
double rate = elapsedSeconds > 0 ? processed / elapsedSeconds : 0.0;
if (!Double.isInfinite(rate) && !Double.isNaN(rate)) {
builder.setMetric("ingest/rate", rate);
} Defensive patterns
Strategy: validation
Validate before calling
double v = metricValue.doubleValue();
if (Double.isInfinite(v)) { v = cap; /* clamp or skip */ }
builder.setMetric(metricName, v); Try / catch
try {
builder.setMetric(name, value);
} catch (IllegalStateException e) {
log.warn("Skipping non-finite metric [%s]", name);
} Prevention
- Check denominators (elapsed time, count) before computing rates
- Use long arithmetic for counters to avoid double overflow
- Clamp or skip infinite values at a single shared emission helper
When it happens
Trigger: Calling setMetric(name, value) where value.doubleValue() is Double.POSITIVE_INFINITY or NEGATIVE_INFINITY — commonly from double overflow or x/0.0 on doubles.
Common situations: Rate/throughput computations dividing by a near-zero elapsed time; cumulative counters overflowing double range; monitors summing unbounded values.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Value of NaN is not allowed!
- Dimension name cannot be null
- Encountered metric with null or empty name at position
- Value of dimension[ ] cannot be null
- A batch appenderator was already created for this peon's…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/530a3c50ba6867b5.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/java/util/emitter/service/ServiceMetricEvent.java:198
throw new IAE("Value of dimension[%s] cannot be null", dim);
}
userDims.put(dim, value);
return this;
}
public Object getDimension(String dim)
{
return userDims.get(dim);
}
public Builder setMetric(String metric, Number value)
{
if (Double.isNaN(value.doubleValue())) {
throw new ISE("Value of NaN is not allowed!");
}
if (Double.isInfinite(value.doubleValue())) {
throw new ISE("Value of Infinite is not allowed!");
}
this.metric = metric;
this.value = value;
return this;
}
public Builder setCreatedTime(DateTime createdTime)
{
this.createdTime = createdTime;
return this;
}
@Override
public ServiceMetricEvent build(ImmutableMap<String, String> serviceDimensions)
{
Preconditions.checkNotNull(metric, "Metric is not set");
Preconditions.checkNotNull(value, "Value is not set");View on GitHub (pinned to 9b90983fd2)