apache/druid · error · org.apache.druid.java.util.common.ISE
Value is not an array, got
Error message
Value is not an array, got [%s] instead
What it means
This error is thrown by VariantArrayFieldColumnWriter.processValue when a value passed to the nested-field array writer is not an Object[]. The writer is only used for array-typed fields, and upstream coercion is supposed to guarantee that every non-null value is an Object[] before reaching this point; encountering anything else means an internal type invariant was violated.
Solutions
- Inspect the input data at the failing row and confirm the array field actually contains arrays at ingestion
- Ensure values pass through the standard nested-field coercion path (FieldTypeInfo/coercion to Object[]) before writing
- Upgrade Druid to a version with the latest nested-column coercion fixes
- File a bug with the failing input row if standard ingestion triggers this
Example fix
// before
writer.processValue(someScalar);
// after
if (!(value instanceof Object[])) { value = value == null ? null : new Object[]{value}; }
writer.processValue((Object[]) value); Defensive patterns
Strategy: type-guard
Validate before calling
if (value != null && !(value instanceof Object[])) { throw new IllegalArgumentException("expected array, got " + value.getClass()); } Type guard
static boolean isArrayValue(Object v) { return v instanceof Object[]; } Try / catch
try { writer.processValue(v); } catch (IllegalStateException e) { if (e.getMessage().startsWith("Value is not an array")) { /* coerce or skip row */ } else { throw e; } } Prevention
- Always funnel nested-field values through ExprEval/StructuredData coercion before writing
- Log the offending row's class when debugging ingestion
- Keep nested-column coercion code paths unchanged across upgrades unless tested
When it happens
Trigger: Writing a nested variant column where a row value for an array field was not coerced to Object[] (e.g. a scalar or null-wrapped value slipped through the coercion in the nested field indexer), or calling processValue directly with a non-array value.
Common situations: Custom or patched ingestion code feeding raw values into the nested column writer; Druid version changes where coercion behavior for mixed-type array fields changed; segment generation during ingestion of JSON with an array field whose elements were flattened or mistyped.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- attempt to get boolean[] null vector from string[] only…
- attempt to get double[] from string[] only scalar binding
- attempt to get long[] from string[] only scalar binding
- Cannot call makeDimensionSelector on field of type
- Cannot cast [ ] to [ ] (Types.InvalidCastException from…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/f63d68fdfb787140.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/segment/nested/VariantArrayFieldColumnWriter.java:73
globalIds[i] = globalDictionaryIdLookup.lookupString((String) array[i]);
} else if (array[i] instanceof Long) {
globalIds[i] = globalDictionaryIdLookup.lookupLong((Long) array[i]);
} else if (array[i] instanceof Double) {
globalIds[i] = globalDictionaryIdLookup.lookupDouble((Double) array[i]);
} else {
globalIds[i] = -1;
}
Preconditions.checkArgument(globalIds[i] >= 0, "unknown global id [%s] for value [%s]", globalIds[i], array[i]);
arrayElements.computeIfAbsent(
globalIds[i],
(id) -> columnFormatSpec.getBitmapEncoding().getBitmapFactory().makeEmptyMutableBitmap()
).add(row);
}
return globalIds;
}
if (value != null) {
// this writer is only used for arrays so all values will have been coerced to Object[] at this point
throw new ISE("Value is not an array, got [%s] instead", value.getClass());
}
return null;
}
@Override
int lookupGlobalId(int[] value)
{
return globalDictionaryIdLookup.lookupArray(value);
}
}
View on GitHub (pinned to 9b90983fd2)