{"record":{"id":"cd3ba0e1b9ac549f","repo":"apache/druid","slug":"invalid-format-specification","errorCode":null,"errorMessage":"Invalid format specification","messagePattern":"Invalid format specification","errorType":"validation","errorClass":"IAE","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/table/InputFormats.java","lineNumber":116,"sourceCode":"          .stream()\n          .map(col -> col.name())\n          .collect(Collectors.toList());\n      jsonMap.put(\"columns\", cols);\n    }\n\n    /**\n     * Convert a generic Java map of input format properties to an input format object.\n     */\n    public InputFormat convert(\n        final Map<String, Object> jsonMap,\n        final ObjectMapper jsonMapper\n    )\n    {\n      try {\n        return jsonMapper.convertValue(jsonMap, inputFormatClass());\n      }\n      catch (Exception e) {\n        throw new IAE(e, \"Invalid format specification\");\n      }\n    }\n\n    @Override\n    public InputFormat convertFromTable(ResolvedExternalTable table)\n    {\n      return convert(table.inputFormatMap, table.resolvedTable().jsonMapper());\n    }\n  }\n\n  /**\n   * Definition of a flat text (CSV and delimited text) input format.\n   * <p>\n   * Note that not all the fields in\n   * {@link org.apache.druid.data.input.impl.FlatTextInputFormat\n   * FlatTextInputFormat} appear here:\n   * <ul>\n   * <li>{@code findColumnsFromHeader} - not yet supported in MSQ.</li>","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/table/InputFormats.java#L98-L134","documentation":"InputFormats.convert wraps Jackson's convertValue of the format JSON map into the concrete InputFormat class; any mapping failure (unknown field, wrong types, bad structure) is rethrown as IllegalArgumentException with 'Invalid format specification'. The original exception is attached as the cause.","triggerScenarios":"Calling convert on an InputFormats.FormatDefn with a jsonMap that does not conform to the target inputFormatClass, e.g. wrong field types or unknown/misspelled fields for the format type.","commonSituations":"Typo in a format option name; supplying a string where an object/array is expected; using options from one format type (e.g. CSV delimiter) on another; format JSON hand-edited incorrectly.","solutions":["Inspect the cause chain of the IAE for Jackson's actual mapping error and fix the offending field","Validate the format JSON against the schema for that format type before conversion","Correct field names and value types to match the target InputFormat class"],"exampleFix":"// before\n{\"type\":\"csv\",\"seperator\":\"|\"}   // misspelled option\n// after\n{\"type\":\"csv\",\"separator\":\"|\"}","handlingStrategy":"try-catch","validationCode":"// verify required fields for the format type before conversion\ndef Map<String,Object> sanitizeCsv(Map<String,Object> m) {\n  if (!\"csv\".equals(m.get(\"type\"))) throw new IllegalArgumentException(\"unsupported format type\");\n  m.keySet().retainAll(List.of(\"type\",\"separator\",\"listDelimiter\",\"skipHeader\"));\n  return m;\n}","typeGuard":null,"tryCatchPattern":"try { format.convert(jsonMap); } catch (IAE e) {\n  Throwable cause = e.getCause();\n  // log cause (Jackson error) to identify the bad field, then fix the format JSON\n}","preventionTips":["Copy format options from docs for the exact format type","Validate format JSON against the InputFormat class schema","Watch for cross-format option typos (e.g. separator vs delimiter)"],"tags":["input-format","json","deserialization","configuration"],"backgroundTag":"invalid-config-value","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"}