{"record":{"id":"029f26d37a45b4a3","repo":"apache/druid","slug":"table-name-is-required","errorCode":null,"errorMessage":"Table name is required","messagePattern":"Table name is required","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/TableMetadata.java","lineNumber":267,"sourceCode":"  }\n\n  @JsonProperty(\"spec\")\n  public TableSpec spec()\n  {\n    return spec;\n  }\n\n  /**\n   * Syntactic validation of a table object. Validates only that which\n   * can be checked from this table object.\n   */\n  public void validate()\n  {\n    if (Strings.isNullOrEmpty(id.schema())) {\n      throw new IAE(\"Database schema is required\");\n    }\n    if (Strings.isNullOrEmpty(id.name())) {\n      throw new IAE(\"Table name is required\");\n    }\n    if (spec == null) {\n      throw new IAE(\"A table definition must include a table spec.\");\n    }\n  }\n\n  @Override\n  public String toString()\n  {\n    return CatalogUtils.toString(this);\n  }\n\n  @Override\n  public boolean equals(Object o)\n  {\n    if (o == this) {\n      return true;\n    }","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/TableMetadata.java#L249-L285","documentation":"Syntactic validation guard in TableMetadata.validate(): a catalog table object must carry a non-empty identifier in its fully qualified table id, since without a table name the definition cannot be addressed, persisted, or referenced by SQL. It fires when a table definition is submitted (create/update via the catalog API or tests) whose id.name() is null or empty; give the table a name in the schema-qualified identifier. Schema and non-null spec are checked by sibling guards in the same method.","triggerScenarios":"Calling TableMetadata.validate() where id.name() is null or empty — e.g. a TableId built with only a schema, or an ID string like \"druid.\" that parses to an empty name.","commonSituations":"Incomplete qualified-name parsing (\"druid.\" with trailing dot); programmatic TableId construction missing the name; truncated JSON id objects in API payloads.","solutions":["Provide a non-empty table name in the TableId before validating","Fix name parsing/splitting logic so the name segment is captured correctly","Validate the identifier string format before constructing TableMetadata"],"exampleFix":"// before\nTableId id = TableId.of(\"druid\", null);\nnew TableMetadata(id, spec).validate();\n// after\nTableId id = TableId.of(\"druid\", \"myTable\");\nnew TableMetadata(id, spec).validate();","handlingStrategy":"validation","validationCode":"if (Strings.isNullOrEmpty(id.name())) {\n  throw new IllegalArgumentException(\"table name is required\");\n}","typeGuard":"boolean hasName(TableMetadata md) {\n  return md.getId() != null && !Strings.isNullOrEmpty(md.getId().name());\n}","tryCatchPattern":"try { md.validate(); } catch (IllegalArgumentException e) { if (e.getMessage().equals(\"Table name is required\")) { /* rebuild TableId with name */ } else { throw e; } }","preventionTips":["Reject identifier strings without a name segment at parse time","Trim and check user-supplied table names before building TableId","Cover TableId parsing with unit tests for degenerate inputs"],"tags":["validation","catalog","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"}