{"record":{"id":"0957877836a18c7d","repo":"apache/druid","slug":"unknown-type-s-095787","errorCode":null,"errorMessage":"Unknown type [%s]","messagePattern":"Unknown type \\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/segment/metadata/AbstractSegmentMetadataCache.java","lineNumber":1126,"sourceCode":"   * for the same column from segment to segment. It is used to help compute a {@link RowSignature} for a table in\n   * Druid based on the segment metadata of all segments, merging the types of each column encountered to end up with\n   * a single type to represent it globally.\n   */\n  @FunctionalInterface\n  public interface ColumnTypeMergePolicy\n  {\n    ColumnType merge(ColumnType existingType, ColumnType newType);\n\n    @JsonCreator\n    static ColumnTypeMergePolicy fromString(String type)\n    {\n      if (LeastRestrictiveTypeMergePolicy.NAME.equalsIgnoreCase(type)) {\n        return LeastRestrictiveTypeMergePolicy.INSTANCE;\n      }\n      if (FirstTypeMergePolicy.NAME.equalsIgnoreCase(type)) {\n        return FirstTypeMergePolicy.INSTANCE;\n      }\n      throw new IAE(\"Unknown type [%s]\", type);\n    }\n  }\n\n  /**\n   * Classic logic, we use the first type we encounter. This policy is effectively 'newest first' because we iterated\n   * segments starting from the most recent time chunk, so this typically results in the most recently used type being\n   * chosen, at least for systems that are continuously updated with 'current' data.\n   *\n   * Since {@link ColumnTypeMergePolicy} are used to compute the SQL schema, at least in systems using SQL schemas which\n   * are partially or fully computed by this cache, this merge policy can result in query time errors if incompatible\n   * types are mixed if the chosen type is more restrictive than the types of some segments. If data is likely to vary\n   * in type across segments, consider using {@link LeastRestrictiveTypeMergePolicy} instead.\n   */\n  public static class FirstTypeMergePolicy implements ColumnTypeMergePolicy\n  {\n    public static final String NAME = \"latestInterval\";\n    private static final FirstTypeMergePolicy INSTANCE = new FirstTypeMergePolicy();\n","sourceCodeStart":1108,"sourceCodeEnd":1144,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/segment/metadata/AbstractSegmentMetadataCache.java#L1108-L1144","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\ndruid.segment.metadata.columnNameTyping=least-restrictive\n// after\ndruid.segment.metadata.columnNameTyping=leastRestrictive","handlingStrategy":"validation","validationCode":"boolean valid = \"leastRestrictive\".equalsIgnoreCase(v) || \"first\".equalsIgnoreCase(v);\nif (!valid) throw new IllegalArgumentException(\"merge policy must be leastRestrictive or first: \" + v);","typeGuard":null,"tryCatchPattern":"try { startMetadataCache(config); } catch (IAE e) { if (e.getMessage().startsWith(\"Unknown type\")) { log.error(\"Fix druid.segment.metadata merge policy config\"); } }","preventionTips":["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."],"tags":["config","enum","json-deserialization","merge-policy"],"backgroundTag":"invalid-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"}