apache/druid · error · IllegalArgumentException

Column name is required

Error message

Column name is required

What it means

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.

Source

Thrown at server/src/main/java/org/apache/druid/catalog/model/ColumnSpec.java:104

  @JsonProperty("dataType")
  @JsonInclude(Include.NON_NULL)
  public String dataType()
  {
    return dataType;
  }

  @JsonProperty("properties")
  @JsonInclude(Include.NON_EMPTY)
  public Map<String, Object> properties()
  {
    return properties;
  }

  public void validate()
  {
    if (Strings.isNullOrEmpty(name)) {
      throw new IAE("Column name is required");
    }
    if (Columns.isTimeColumn(name)) {
      if (dataType != null && !Columns.LONG.equalsIgnoreCase(dataType)) {
        throw new IAE(
            "[%s] column must have type [%s] or no type. Found [%s]",
            name,
            Columns.LONG,
            dataType
        );
      }
    }
    // Validate type in the next PR
  }

  /**
   * Merges an updated version of this column with an existing version.
   * <p>
   * The name cannot be changed (it is what links the existing column and the

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Add the required "name" property to the column specification.
  2. Check for trailing commas or structural mistakes that make a column object parse with fields shifted.
  3. Validate specs before submission: for each column, ensure name != null && !name.isEmpty().

Example fix

// before
{"columns": [{"dataType": "long"}]}
// after
{"columns": [{"name": "count", "dataType": "long"}]}
Defensive patterns

Strategy: validation

Validate before calling

for (Map<String, Object> col : columns) {
  Object n = col.get("name");
  if (n == null || n.toString().isEmpty()) {
    throw new IllegalArgumentException("Every column spec requires a name");
  }
}

Type guard

boolean hasName(ColumnSpec spec) { return spec.getName() != null && !spec.getName().isEmpty(); }

Try / catch

try { spec.validate(); } catch (IllegalArgumentException e) { log.error("Invalid column spec: %s", e.getMessage()); }

Prevention

When it happens

Trigger: 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".

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/d050f8f5180bc25c. Report an issue: GitHub.