{"record":{"id":"728aa188c5e2b6fd","repo":"apache/druid","slug":"table-type-s-is-not-valid","errorCode":null,"errorMessage":"Table type [%s] is not valid.","messagePattern":"Table type \\[(.+?)\\] is not valid\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/TableDefnRegistry.java","lineNumber":149,"sourceCode":"  public TableDefn tableDefnFor(String type)\n  {\n    return tableDefns.get(type);\n  }\n\n  public ObjectMapper jsonMapper()\n  {\n    return jsonMapper;\n  }\n\n  public ResolvedTable resolve(TableSpec spec)\n  {\n    String type = spec.type();\n    if (Strings.isNullOrEmpty(type)) {\n      throw new IAE(\"The table type is required.\");\n    }\n    TableDefn defn = tableDefns.get(type);\n    if (defn == null) {\n      throw new IAE(\"Table type [%s] is not valid.\", type);\n    }\n    return new ResolvedTable(defn, spec, jsonMapper);\n  }\n\n  /**\n   * Return input source definition for the given input source type name, or\n   * {@code null} if there is no such definition.\n   */\n  public InputSourceDefn inputSourceDefnFor(String type)\n  {\n    return inputSourceDefns.get(type);\n  }\n\n  /**\n   * Return input format definition for the given input format type name, or\n   * {@code null} if there is no such definition.\n   */\n  public InputFormatDefn inputFormatDefnFor(String type)","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/TableDefnRegistry.java#L131-L167","documentation":"TableDefnRegistry.resolve() found a non-empty type on the spec, but no TableDefn is registered under that name. Only registered table types (e.g. \"datasource\") can be resolved; unknown types cannot be given a definition.","triggerScenarios":"Calling resolve() (or table()/unsealed()/resolved()) with a TableSpec whose type string is not a key in the registry's tableDefns map (typo, unsupported type, or definition not registered in this registry instance).","commonSituations":"Typo in the type string (e.g. \"datasource\"); using a type introduced in a newer Druid version on an older cluster; constructing a registry that omitted the needed definition; reading specs produced by another system.","solutions":["Correct the type string to a registered type (e.g. \"datasource\")","Check which table definitions the registry instance was built with and add the missing one if custom","Upgrade Druid if the table type is newer than the running version"],"exampleFix":"// before\nTableSpec spec = new TableSpec(\"data_source\", props, columns); // typo\nregistry.resolve(spec);\n// after\nTableSpec spec = new TableSpec(\"datasource\", props, columns);\nregistry.resolve(spec);","handlingStrategy":"validation","validationCode":"Set<String> known = registry.tableDefns().keySet(); // via available definitions\nif (!known.contains(spec.type())) {\n  throw new IllegalArgumentException(\"unknown type: \" + spec.type());\n}","typeGuard":"boolean isKnownType(TableDefnRegistry registry, TableSpec spec) {\n  return spec.type() != null && registry.resolveOrNull(spec) != null;\n}","tryCatchPattern":"try { return registry.resolve(spec); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Table type [\")) { /* fall back to default handling / report unknown type */ } else { throw e; } }","preventionTips":["Keep a list of valid type strings (single constant) instead of free-text","Verify the registry is built with all definitions your specs use","Guard against version skew when sharing specs across clusters"],"tags":["registry","invalid-value","catalog"],"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"}