{"record":{"id":"7e1b6459466d0fd3","repo":"apache/druid","slug":"an-inline-input-source-must-provide-a-format","errorCode":null,"errorMessage":"An inline input source must provide a format.","messagePattern":"An inline input source must provide a format\\.","errorType":"validation","errorClass":"IAE","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/table/InlineInputSourceDefn.java","lineNumber":80,"sourceCode":"  protected List<ParameterDefn> adHocTableFnParameters()\n  {\n    return Collections.singletonList(\n        new Parameter(DATA_PROPERTY, ParameterType.VARCHAR_ARRAY, false)\n    );\n  }\n\n  @Override\n  public TableFunction partialTableFn(ResolvedExternalTable table)\n  {\n    return new PartialTableFunction(table, Collections.emptyList());\n  }\n\n  @Override\n  public void validate(ResolvedExternalTable table)\n  {\n    // For inline, format is required to match the data\n    if (table.inputFormatMap == null) {\n      throw new IAE(\"An inline input source must provide a format.\");\n    }\n    if (CollectionUtils.isNullOrEmpty(table.resolvedTable().spec().columns())) {\n      throw new IAE(\"An inline input source must provide one or more columns\");\n    }\n\n    super.validate(table);\n  }\n\n  @Override\n  protected void convertArgsToSourceMap(Map<String, Object> jsonMap, Map<String, Object> args)\n  {\n    jsonMap.put(InputSource.TYPE_PROPERTY, InlineInputSource.TYPE_KEY);\n    List<String> data = CatalogUtils.getStringArray(args, DATA_PROPERTY);\n\n    // Would be nice, from a completeness perspective, for the inline data\n    // source to allow zero rows of data. However, such is not the case.\n    if (CollectionUtils.isNullOrEmpty(data)) {\n      throw new IAE(","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/table/InlineInputSourceDefn.java#L62-L98","documentation":"InlineInputSourceDefn.validate requires that an inline external table specifies an input format. Inline data is raw text parsed according to a format, so without one Druid cannot interpret the rows. Thrown as IllegalArgumentException during table validation when inputFormatMap is null.","triggerScenarios":"Validating (validate) a ResolvedExternalTable of inline type whose resolved table spec has no input format map — e.g. table created without a format property or with an empty format section.","commonSituations":"Creating an inline table in the catalog and forgetting the format property; copying an inline source snippet without its format block; a UI/API client that omits format when columns are provided.","solutions":["Add an input format (e.g. {\"type\":\"csv\"}) to the inline table spec","Verify the table JSON includes a non-empty format section before submitting","Use validation tooling or the catalog API to check the spec before save"],"exampleFix":"// before\n{\"source\":{\"type\":\"inline\",\"data\":\"a,b\"}}\n// after\n{\"source\":{\"type\":\"inline\",\"data\":\"a,b\"},\"format\":{\"type\":\"csv\"}}","handlingStrategy":"validation","validationCode":"if (spec.getSource().getType().equals(\"inline\") && spec.getInputFormatMap() == null) {\n  throw new IllegalArgumentException(\"inline source requires an input format\");\n}","typeGuard":null,"tryCatchPattern":"try { defn.validate(table); } catch (IAE e) { if (e.getMessage().contains(\"must provide a format\")) { /* add format to spec */ } else { throw e; } }","preventionTips":["Always include a format block (csv, json, etc.) in inline table specs","Build specs via helpers that enforce format presence","Validate spec JSON before saving to the catalog"],"tags":["inline","input-source","validation","missing-field"],"backgroundTag":"missing-required-config-field","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}