{"record":{"id":"cc61152a70554cf8","repo":"apache/druid","slug":"unknown-metric-value-type-s","errorCode":null,"errorMessage":"Unknown metric value type: %s","messagePattern":"Unknown metric value type: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java","lineNumber":795,"sourceCode":"  {\n    final MetricDesc metricDesc = rowSelector.getMetric(metric);\n    if (metricDesc == null) {\n      return NilColumnValueSelector.instance();\n    }\n    int metricIndex = metricDesc.getIndex();\n    switch (metricDesc.getCapabilities().getType()) {\n      case COMPLEX:\n        return new ObjectMetricColumnSelector(rowSelector, currEntry, metricDesc);\n      case LONG:\n        return new LongMetricColumnSelector(rowSelector, currEntry, metricIndex);\n      case FLOAT:\n        return new FloatMetricColumnSelector(rowSelector, currEntry, metricIndex);\n      case DOUBLE:\n        return new DoubleMetricColumnSelector(rowSelector, currEntry, metricIndex);\n      case STRING:\n        throw new IllegalStateException(\"String is not a metric column type\");\n      default:\n        throw new ISE(\"Unknown metric value type: %s\", metricDesc.getCapabilities().getType());\n    }\n  }\n\n  public Interval getInterval()\n  {\n    DateTime min = DateTimes.utc(minTimestamp);\n    return new Interval(min, isEmpty() ? min : queryGranularity.increment(DateTimes.utc(getMaxTimeMillis())));\n  }\n\n  @Nullable\n  public DateTime getMinTime()\n  {\n    return isEmpty() ? null : DateTimes.utc(getMinTimeMillis());\n  }\n\n  @Nullable\n  public DateTime getMaxTime()\n  {","sourceCodeStart":777,"sourceCodeEnd":813,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/segment/incremental/IncrementalIndex.java#L777-L813","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n\"metricsSpec\": { \"metrics\": [ { \"type\": \"stringFirst\", \"name\": \"tags\", \"fieldName\": \"tags\" } ] }\n// after\n\"metricsSpec\": { \"metrics\": [ { \"type\": \"longSum\", \"name\": \"count\", \"fieldName\": \"count\" } ] }","handlingStrategy":"validation","validationCode":"for (AggregatorFactory f : spec.getMetricsSpec()) {\n  String t = f.getTypeName();\n  if (!(t.equals(\"long\") || t.equals(\"float\") || t.equals(\"double\"))) {\n    throw new IllegalArgumentException(\"Unsupported metric type: \" + t);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { index.add(row); } catch (ISE e) { if (e.getMessage().startsWith(\"Unknown metric value type\")) { /* halt and fix metricsSpec */ } throw e; }","preventionTips":["Keep metrics numeric-only in ingestion specs","Re-validate specs when upgrading Druid versions"],"tags":["ingestion","schema","metric-type"],"backgroundTag":"unsupported-enum-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}