apache/druid · error · IAE

hasMultipleValues[ ] is already set, cannot change to[ ]

Error message

hasMultipleValues[%s] is already set, cannot change to[%s]

What it means

Companion guard to the valueType check: ColumnDescriptor.Builder.setHasMultipleValues rejects changing a previously set multi-value flag to a different value. It ensures a column's multi-valuedness is consistent across all parts written into the descriptor.

Solutions

  1. Make input segments consistent: the column must be uniformly single- or multi-valued across merged segments
  2. Fix the code path that sets the flag twice with different values
  3. Re-ingest data with normalized (single- or array-typed) values for the column

Example fix

// before
builder.setHasMultipleValues(true);
builder.setHasMultipleValues(false); // IAE
// after
builder.setHasMultipleValues(hasMultipleValues); // computed once from the column
Defensive patterns

Strategy: validation

Validate before calling

Set<Boolean> flags = inputs.stream().map(s -> s.hasMultipleValues(col)).collect(Collectors.toSet());
if (flags.size() > 1) throw new IllegalStateException("mixed multi-valuedness");

Try / catch

try { builder.setHasMultipleValues(mv); } catch (IAE e) { /* reconcile flag from inputs and rebuild */ }

Prevention

When it happens

Trigger: Building a column descriptor where setHasMultipleValues(true) then setHasMultipleValues(false) (or vice versa) is called, e.g. metrics/indexer code paths disagreeing on multi-valuedness.

Common situations: Merging segments where the same column is single-valued in one and multi-valued in another; custom aggregators or extensions setting the flag twice; arrays introduced to a previously scalar column.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/segment/column/ColumnDescriptor.java:157

    private ValueType valueType = null;
    @Nullable
    private Boolean hasMultipleValues = null;

    private final List<ColumnPartSerde> parts = new ArrayList<>();

    public Builder setValueType(ValueType valueType)
    {
      if (this.valueType != null && this.valueType != valueType) {
        throw new IAE("valueType[%s] is already set, cannot change to[%s]", this.valueType, valueType);
      }
      this.valueType = valueType;
      return this;
    }

    public Builder setHasMultipleValues(boolean hasMultipleValues)
    {
      if (this.hasMultipleValues != null && this.hasMultipleValues != hasMultipleValues) {
        throw new IAE(
            "hasMultipleValues[%s] is already set, cannot change to[%s]", this.hasMultipleValues, hasMultipleValues
        );
      }
      this.hasMultipleValues = hasMultipleValues;
      return this;
    }

    public Builder addSerde(ColumnPartSerde serde)
    {
      parts.add(serde);
      return this;
    }

    public ColumnDescriptor build()
    {
      Preconditions.checkNotNull(valueType, "must specify a valueType");
      return new ColumnDescriptor(valueType, hasMultipleValues == null ? false : hasMultipleValues, parts);
    }

View on GitHub (pinned to 9b90983fd2)