{"record":{"id":"54da27b038d2afec","repo":"apache/seatunnel","slug":"file-type-invalid-54da27","errorCode":"FILE_TYPE_INVALID","errorMessage":"This file [%s] is not a parquet file, please check the format of this file","messagePattern":"This file \\[(.+?)\\] is not a parquet file, please check the format of this file","errorType":"exception","errorClass":"FileConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/ParquetReadStrategy.java","lineNumber":127,"sourceCode":"            log.warn(\n                    \"Failed to read parquet file [{}] with Avro reader due to illegal Avro field\"\n                            + \" name, fallback to native parquet reader\",\n                    split.getFilePath(),\n                    e);\n            readWithNativeParquet(split, output);\n        }\n    }\n\n    private void readWithAvro(FileSourceSplit split, Collector<SeaTunnelRow> output)\n            throws IOException, FileConnectorException {\n        String tableId = split.getTableId();\n        String path = split.getFilePath();\n        if (Boolean.FALSE.equals(checkFileType(path))) {\n            String errorMsg =\n                    String.format(\n                            \"This file [%s] is not a parquet file, please check the format of this file\",\n                            path);\n            throw new FileConnectorException(FileConnectorErrorCode.FILE_TYPE_INVALID, errorMsg);\n        }\n        Path filePath = new Path(path);\n        Map<String, String> partitionsMap = parsePartitionsByPath(path);\n        HadoopInputFile hadoopInputFile =\n                hadoopFileSystemProxy.doWithHadoopAuth(\n                        (configuration, userGroupInformation) ->\n                                HadoopInputFile.fromPath(filePath, configuration));\n        int fieldsCount = seaTunnelRowType.getTotalFields();\n        GenericData dataModel = new GenericData();\n        dataModel.addLogicalTypeConversion(new Conversions.DecimalConversion());\n        dataModel.addLogicalTypeConversion(new TimeConversions.DateConversion());\n        dataModel.addLogicalTypeConversion(new TimeConversions.LocalTimestampMillisConversion());\n        final boolean useSplitRange =\n                enableSplitFile && split.getStart() >= 0 && split.getLength() > 0;\n        GenericRecord record;\n        AvroParquetReader.Builder<GenericData.Record> builder =\n                AvroParquetReader.<GenericData.Record>builder(hadoopInputFile)\n                        .withDataModel(dataModel);","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/ParquetReadStrategy.java#L109-L145","documentation":"ParquetReadStrategy.readWithAvro first validates that the file assigned to the split really is a Parquet file (checkFileType inspects the magic header/extension). If not, it refuses to open it with FILE_TYPE_INVALID rather than failing later inside the parquet reader.","triggerScenarios":"A source read reaches readWithAvro (via read) for a file whose path fails checkFileType — i.e. the file is not Parquet (wrong magic bytes or extension) while the read strategy selected is the Parquet one.","commonSituations":"file_format_type configured as parquet but the directory contains ORC/CSV/text files; files with .parquet extension that are actually another format; mixed-format directories read via a wildcard path.","solutions":["Verify the actual format with `file <path>` or by checking the first bytes for the 'PAR1' magic.","Correct the file_format_type in the source config to match the real file format.","Narrow the source path/pattern so only genuine Parquet files are matched.","Re-export/convert the data to real Parquet if the files were mislabeled."],"exampleFix":"// before\nFaT = { source = { file = { file_format_type = \"parquet\", path = \"/data/mixed\" } } }\n\n// after: match only parquet files\npath = \"/data/mixed/*.parquet\" // and confirm magic bytes are PAR1","handlingStrategy":"validation","validationCode":"// Verify parquet magic bytes before configuring/reading the path\nbyte[] head = new byte[4];\ntry (InputStream in = Files.newInputStream(Paths.get(path))) {\n    if (in.read(head) != 4 || !Arrays.equals(head, \"PAR1\".getBytes(StandardCharsets.US_ASCII))) {\n        throw new IllegalStateException(path + \" is not a parquet file\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    rows = parquetSource.read();\n} catch (FileConnectorException e) {\n    if (e.getMessage().contains(\"is not a parquet file\")) {\n        // switch file_format_type or fix the path pattern\n    } else throw e;\n}","preventionTips":["Check magic bytes ('PAR1') rather than trusting file extensions","Don't mix formats in a single source directory","Use precise path patterns (e.g. *.parquet) in the source config","Validate a sample file after every upstream format/export change"],"tags":["parquet","file-format","configuration","file-connector"],"backgroundTag":"incompatible-source-type","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}