apache/druid · error · ParseException
Could not ingest value [%s] as long for dimension [%s]. A lo
Error message
Could not ingest value [%s] as long for dimension [%s]. A long column cannot have multiple values in the same row.
What it means
convertObjectToLong throws this ParseException when the value is a List: long columns are single-valued, so a multi-value (list) input cannot be converted to long. Druid rejects multi-value rows for numeric columns during ingestion.
Source
Thrown at processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java:422
}
throw new ParseException((String) valObj, message);
}
return ret;
} else if (valObj instanceof List) {
final String message;
if (objectKey != null) {
message = StringUtils.nonStrictFormat(
"Could not ingest value [%s] as long for dimension [%s]. A long column cannot have multiple values in the same row.",
valObj,
objectKey
);
} else {
message = StringUtils.nonStrictFormat(
"Could not ingest value [%s] as long. A long column cannot have multiple values in the same row.",
valObj
);
}
throw new ParseException(
valObj.getClass().toString(),
message
);
} else {
final String message;
if (objectKey != null) {
message = StringUtils.nonStrictFormat(
"Could not convert value [%s] to long for dimension [%s]. Invalid type: [%s]",
valObj,
objectKey,
valObj.getClass()
);
} else {
message = StringUtils.nonStrictFormat(
valObj.getClass().toString(),
"Could not convert value [%s] to long. Invalid type: [%s]",
valObj,
valObj.getClass()View on GitHub (pinned to 9b90983fd2)
Solutions
- Flatten or unnest the array before ingestion (e.g. use an auto-deny/unfold, or a transform taking the first element).
- Ensure the input spec declares the field as a multi-value string dimension instead of long if it's genuinely multi-valued.
- Pre-process input so numeric columns are scalars (e.g. take element [0] or join).
- Use a transform like "CAST(json_query(...), 'LONG')" or extract a single value deterministically.
Example fix
// before: row has "vals": [10, 20] for long column vals
// after: transform to take the first element
"transforms": [{"type": "expression", "name": "vals", "expression": "CAST(vals[0] AS LONG)"}] Defensive patterns
Strategy: validation
Validate before calling
boolean isScalar(Object v) {
return v == null || !(v instanceof List);
} Type guard
Long firstAsLong(Object v) {
if (v instanceof List) {
List<?> l = (List<?>) v;
return l.isEmpty() ? null : asLong(l.get(0));
}
return asLong(v);
} Try / catch
try {
return DimensionHandlerUtils.convertObjectToLong(value, fieldName, objectKey);
} catch (ParseException e) {
if (e.getMessage().contains("multiple values")) {
log.warn("Dropping multi-valued row for long field [%s]", fieldName);
return null;
}
throw e;
} Prevention
- Ensure numeric columns receive scalar values only
- Declare genuinely multi-valued fields as multi-value string dimensions
- Use transforms to unnest arrays (take element or aggregate) before conversion
- Validate JSON payload shape in producers
When it happens
Trigger: A row's value for a long column is a List (multi-value dimension from JSON/Kafka input), and convertObjectToLong is invoked; also hit by convertObjectToType dispatching to convertObjectToLong.
Common situations: Nested/array JSON fields mapped to a long column; flattened event data that occasionally contains multiple values (e.g. "ids": [1,2]); Kafka/JSON input with inconsistent cardinality per row.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Could not ingest value [%s] as float for dimension [%s]. A f
- Could not ingest value [%s] as double for dimension [%s]. A
- Could not convert value [%s] to long.
- Could not convert value [%s] to long for dimension [%s]. Inv
- Could not convert value [%s] to float.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/bbf810eb603b5cd1.
Report an issue: GitHub.