{"record":{"id":"d050f8f5180bc25c","repo":"apache/druid","slug":"column-name-is-required","errorCode":null,"errorMessage":"Column name is required","messagePattern":"Column name is required","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/ColumnSpec.java","lineNumber":104,"sourceCode":"\n  @JsonProperty(\"dataType\")\n  @JsonInclude(Include.NON_NULL)\n  public String dataType()\n  {\n    return dataType;\n  }\n\n  @JsonProperty(\"properties\")\n  @JsonInclude(Include.NON_EMPTY)\n  public Map<String, Object> properties()\n  {\n    return properties;\n  }\n\n  public void validate()\n  {\n    if (Strings.isNullOrEmpty(name)) {\n      throw new IAE(\"Column name is required\");\n    }\n    if (Columns.isTimeColumn(name)) {\n      if (dataType != null && !Columns.LONG.equalsIgnoreCase(dataType)) {\n        throw new IAE(\n            \"[%s] column must have type [%s] or no type. Found [%s]\",\n            name,\n            Columns.LONG,\n            dataType\n        );\n      }\n    }\n    // Validate type in the next PR\n  }\n\n  /**\n   * Merges an updated version of this column with an existing version.\n   * <p>\n   * The name cannot be changed (it is what links the existing column and the","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/ColumnSpec.java#L86-L122","documentation":"ColumnSpec.validate enforces that every column specification carries a non-empty name. A ColumnSpec without a name cannot be merged into a table schema or referenced by the catalog, so it is rejected with this IllegalArgumentException.","triggerScenarios":"Calling validate() directly, or mergeColumn/testColumnSpec which delegate to it, on a ColumnSpec whose name field is null or empty — e.g. a JSON column entry like {\"dataType\": \"string\"} without \"name\".","commonSituations":"Hand-written table specs where a column object omits the name key; JSON arrays built programmatically with entries missing the name; copy-paste that dropped the first line of a column definition.","solutions":["Add the required \"name\" property to the column specification.","Check for trailing commas or structural mistakes that make a column object parse with fields shifted.","Validate specs before submission: for each column, ensure name != null && !name.isEmpty()."],"exampleFix":"// before\n{\"columns\": [{\"dataType\": \"long\"}]}\n// after\n{\"columns\": [{\"name\": \"count\", \"dataType\": \"long\"}]}","handlingStrategy":"validation","validationCode":"for (Map<String, Object> col : columns) {\n  Object n = col.get(\"name\");\n  if (n == null || n.toString().isEmpty()) {\n    throw new IllegalArgumentException(\"Every column spec requires a name\");\n  }\n}","typeGuard":"boolean hasName(ColumnSpec spec) { return spec.getName() != null && !spec.getName().isEmpty(); }","tryCatchPattern":"try { spec.validate(); } catch (IllegalArgumentException e) { log.error(\"Invalid column spec: %s\", e.getMessage()); }","preventionTips":["Always include the name key in every column object.","Generate columns programmatically from a schema source that guarantees names.","Lint specs for missing keys before submitting to the catalog."],"tags":["catalog","column","validation","missing-field"],"backgroundTag":"missing-required-argument","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}