apache/druid · critical · IllegalStateException
Unknown metric value type
Error message
Unknown metric value type: %s
What it means
IncrementalIndex throws this ISE when building a metric column selector for a metric whose ValueType is not LONG, FLOAT, or DOUBLE. It is an internal guard in factRowSelector/makeMetricColumnSelector: only numeric metric types are supported in the ingestion index. Encountering it means a metric column resolved to an unexpected type.
Solutions
- Fix the metricsSpec so every metric is LONG, FLOAT, or DOUBLE (e.g. change 'string' to 'long' or wrap with the correct aggregator)
- Check the input field actually contains numeric values and remove it from metricsSpec if it is a dimension
- Upgrade Druid if a new ValueType was added upstream and this build predates its selector
Example fix
// before
"metricsSpec": { "metrics": [ { "type": "stringFirst", "name": "tags", "fieldName": "tags" } ] }
// after
"metricsSpec": { "metrics": [ { "type": "longSum", "name": "count", "fieldName": "count" } ] } Defensive patterns
Strategy: validation
Validate before calling
for (AggregatorFactory f : spec.getMetricsSpec()) {
String t = f.getTypeName();
if (!(t.equals("long") || t.equals("float") || t.equals("double"))) {
throw new IllegalArgumentException("Unsupported metric type: " + t);
}
} Try / catch
try { index.add(row); } catch (ISE e) { if (e.getMessage().startsWith("Unknown metric value type")) { /* halt and fix metricsSpec */ } throw e; } Prevention
- Keep metrics numeric-only in ingestion specs
- Re-validate specs when upgrading Druid versions
When it happens
Trigger: Ingesting rows into an IncrementalIndex (realtime/Kafka ingestion) where a metric configured in the metricsSpec has an unsupported ValueType (e.g. STRING or an unknown type) so the switch in factRowSelector falls through to default.
Common situations: Metrics spec mistakes: declaring a dimension as a metric, using a string-typed field as a metric, or schema/API version changes that introduce new ValueTypes not handled by the running Druid version.
Related errors
- incrementIndexSchema cannot be null
- String is not a metric column type
- Aggregation [ ] does not support column [ ] of type [ ]…
- An inline input source must provide one or more columns
- Attempt to add row to swapped-out sink for segment
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/cc61152a70554cf8.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java:795
{
final MetricDesc metricDesc = rowSelector.getMetric(metric);
if (metricDesc == null) {
return NilColumnValueSelector.instance();
}
int metricIndex = metricDesc.getIndex();
switch (metricDesc.getCapabilities().getType()) {
case COMPLEX:
return new ObjectMetricColumnSelector(rowSelector, currEntry, metricDesc);
case LONG:
return new LongMetricColumnSelector(rowSelector, currEntry, metricIndex);
case FLOAT:
return new FloatMetricColumnSelector(rowSelector, currEntry, metricIndex);
case DOUBLE:
return new DoubleMetricColumnSelector(rowSelector, currEntry, metricIndex);
case STRING:
throw new IllegalStateException("String is not a metric column type");
default:
throw new ISE("Unknown metric value type: %s", metricDesc.getCapabilities().getType());
}
}
public Interval getInterval()
{
DateTime min = DateTimes.utc(minTimestamp);
return new Interval(min, isEmpty() ? min : queryGranularity.increment(DateTimes.utc(getMaxTimeMillis())));
}
@Nullable
public DateTime getMinTime()
{
return isEmpty() ? null : DateTimes.utc(getMinTimeMillis());
}
@Nullable
public DateTime getMaxTime()
{View on GitHub (pinned to 9b90983fd2)