apache/druid · error · IllegalArgumentException
Unknown type [ ]
Error message
Unknown type [%s]
What it means
Thrown by the @JsonCreator ColumnTypeMergePolicy.fromString in AbstractSegmentMetadataCache when a configured column type merge policy string is not one of the supported names ('leastRestrictive' or 'first'). The merge policy controls how column types are unified across segments when computing a table's RowSignature.
Solutions
- Set the merge policy value to exactly 'leastRestrictive' or 'first' (case-insensitive).
- Check the Druid version's supported policies; names may differ across versions.
- Search runtime properties/JSON config for the merge policy key and correct the typo.
- Restart the broker/historical after fixing the config.
Example fix
// before druid.segment.metadata.columnNameTyping=least-restrictive // after druid.segment.metadata.columnNameTyping=leastRestrictive
Defensive patterns
Strategy: validation
Validate before calling
boolean valid = "leastRestrictive".equalsIgnoreCase(v) || "first".equalsIgnoreCase(v);
if (!valid) throw new IllegalArgumentException("merge policy must be leastRestrictive or first: " + v); Try / catch
try { startMetadataCache(config); } catch (IAE e) { if (e.getMessage().startsWith("Unknown type")) { log.error("Fix druid.segment.metadata merge policy config"); } } Prevention
- Use only documented merge policy names: leastRestrictive or first.
- Validate runtime.properties values against the current Druid version's config reference.
- Add config linting in deployment pipelines to catch typo'd enum values.
When it happens
Trigger: Deserializing a ColumnTypeMergePolicy from config (e.g. druid.segment.metadata columnNameTyping or equivalent metadata cache config) with a value other than 'leastRestrictive' or 'first' (case-insensitive).
Common situations: Typo in the config value (e.g. 'least-restrictive', 'firsttype'); using a policy name from a different Druid version; YAML/JSON config quoting mistakes; copy-pasted config from a fork.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid druid.storage.transfer.asyncHttpClientType
- Invalid value[ ] for[ ]
- Null worker assignment strategy
- Ambiguous directions
- At least one of baseDir or files should be specified
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/0957877836a18c7d.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/main/java/org/apache/druid/segment/metadata/AbstractSegmentMetadataCache.java:1126
* for the same column from segment to segment. It is used to help compute a {@link RowSignature} for a table in
* Druid based on the segment metadata of all segments, merging the types of each column encountered to end up with
* a single type to represent it globally.
*/
@FunctionalInterface
public interface ColumnTypeMergePolicy
{
ColumnType merge(ColumnType existingType, ColumnType newType);
@JsonCreator
static ColumnTypeMergePolicy fromString(String type)
{
if (LeastRestrictiveTypeMergePolicy.NAME.equalsIgnoreCase(type)) {
return LeastRestrictiveTypeMergePolicy.INSTANCE;
}
if (FirstTypeMergePolicy.NAME.equalsIgnoreCase(type)) {
return FirstTypeMergePolicy.INSTANCE;
}
throw new IAE("Unknown type [%s]", type);
}
}
/**
* Classic logic, we use the first type we encounter. This policy is effectively 'newest first' because we iterated
* segments starting from the most recent time chunk, so this typically results in the most recently used type being
* chosen, at least for systems that are continuously updated with 'current' data.
*
* Since {@link ColumnTypeMergePolicy} are used to compute the SQL schema, at least in systems using SQL schemas which
* are partially or fully computed by this cache, this merge policy can result in query time errors if incompatible
* types are mixed if the chosen type is more restrictive than the types of some segments. If data is likely to vary
* in type across segments, consider using {@link LeastRestrictiveTypeMergePolicy} instead.
*/
public static class FirstTypeMergePolicy implements ColumnTypeMergePolicy
{
public static final String NAME = "latestInterval";
private static final FirstTypeMergePolicy INSTANCE = new FirstTypeMergePolicy();
View on GitHub (pinned to 9b90983fd2)