{"record":{"id":"e07188dea3bfc80e","repo":"apache/flink","slug":"the-type-is-not-supported-for-the-csv-input-f","errorCode":null,"errorMessage":"The type '{}' is not supported for the CSV input format.","messagePattern":"The type '(.+?)' is not supported for the CSV input format\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/io/GenericCsvInputFormat.java","lineNumber":216,"sourceCode":"            return types;\n        }\n    }\n\n    protected void setFieldTypesGeneric(Class<?>... fieldTypes) {\n        if (fieldTypes == null) {\n            throw new IllegalArgumentException(\"Field types must not be null.\");\n        }\n\n        this.fieldIncluded = new boolean[fieldTypes.length];\n        ArrayList<Class<?>> types = new ArrayList<Class<?>>();\n\n        // check if we support parsers for these types\n        for (int i = 0; i < fieldTypes.length; i++) {\n            Class<?> type = fieldTypes[i];\n\n            if (type != null) {\n                if (FieldParser.getParserForType(type) == null) {\n                    throw new IllegalArgumentException(\n                            \"The type '\"\n                                    + type.getName()\n                                    + \"' is not supported for the CSV input format.\");\n                }\n                types.add(type);\n                fieldIncluded[i] = true;\n            }\n        }\n\n        this.fieldTypes = types.toArray(new Class<?>[types.size()]);\n    }\n\n    protected void setFieldsGeneric(int[] sourceFieldIndices, Class<?>[] fieldTypes) {\n        checkNotNull(sourceFieldIndices);\n        checkNotNull(fieldTypes);\n        checkArgument(\n                sourceFieldIndices.length == fieldTypes.length,\n                \"Number of field indices and field types must match.\");","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/io/GenericCsvInputFormat.java#L198-L234","documentation":"Thrown by GenericCsvInputFormat.setFieldTypesGeneric when a provided field type has no registered FieldParser. Flink's CSV parsing relies on a fixed table of FieldParser implementations (Byte, Short, Integer, Long, Float, Double, Boolean, String, BigDecimal, BigInteger, the *Value variants, and java.sql.Date/Time/Timestamp). Types outside this set — primitives, custom POJOs, arrays, List/Map, java.time types — cannot be parsed and are rejected.","triggerScenarios":"Passing a primitive class such as int.class or long.class (the format expects the boxed wrappers); passing a custom POJO/record class; passing java.time.LocalDate/LocalDateTime; passing array or collection types.","commonSituations":"Using int.class instead of Integer.class; mapping CSV columns to a custom POJO directly instead of a tuple of supported types; migrating to java.time types without realizing only java.sql date/time are supported.","solutions":["Use the boxed wrapper types from the supported set: Integer.class, Long.class, Double.class, String.class, etc.","For dates/times use java.sql.Date.class, java.sql.Time.class, java.sql.Timestamp.class (not java.time.*).","For complex/POJO types, read the CSV into a Tuple of supported types and map to the POJO in a subsequent step.","Prefer the modern Table API/SQL CSV connector, which supports a richer type system."],"exampleFix":"// before\nformat.setFieldTypesGeneric(int.class, String.class, LocalDate.class);\n\n// after\nformat.setFieldTypesGeneric(Integer.class, String.class, java.sql.Date.class);","handlingStrategy":"type-guard","validationCode":"private static final Set<Class<?>> SUPPORTED = Set.of(\n    Byte.class, Short.class, Integer.class, Long.class, Float.class,\n    Double.class, Boolean.class, String.class, BigDecimal.class, BigInteger.class,\n    java.sql.Date.class, java.sql.Time.class, java.sql.Timestamp.class);\nfor (Class<?> t : types) {\n    if (t != null && !SUPPORTED.contains(t)) {\n        throw new IllegalArgumentException(\"Unsupported CSV type: \" + t);\n    }\n}","typeGuard":"static boolean isSupportedCsvType(Class<?> t) {\n    return t == null || FieldParser.getParserForType(t) != null;\n}","tryCatchPattern":null,"preventionTips":["Use boxed wrapper types (Integer, Long, Double), not primitives.","Use java.sql.Date/Time/Timestamp, not java.time.*.","Read into a Tuple of supported types, then map to POJOs.","Prefer the Table API/SQL CSV connector for richer type support."],"tags":["flink","csv","input-format","type-system","field-parser"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}