apache/seatunnel · error · FileConnectorException
FILE_TYPE_INVALID
FILE_TYPE_INVALID
Error message
This file [%s] is not a parquet file, please check the format of this file
What it means
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.
Source
Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/ParquetReadStrategy.java:127
log.warn(
"Failed to read parquet file [{}] with Avro reader due to illegal Avro field"
+ " name, fallback to native parquet reader",
split.getFilePath(),
e);
readWithNativeParquet(split, output);
}
}
private void readWithAvro(FileSourceSplit split, Collector<SeaTunnelRow> output)
throws IOException, FileConnectorException {
String tableId = split.getTableId();
String path = split.getFilePath();
if (Boolean.FALSE.equals(checkFileType(path))) {
String errorMsg =
String.format(
"This file [%s] is not a parquet file, please check the format of this file",
path);
throw new FileConnectorException(FileConnectorErrorCode.FILE_TYPE_INVALID, errorMsg);
}
Path filePath = new Path(path);
Map<String, String> partitionsMap = parsePartitionsByPath(path);
HadoopInputFile hadoopInputFile =
hadoopFileSystemProxy.doWithHadoopAuth(
(configuration, userGroupInformation) ->
HadoopInputFile.fromPath(filePath, configuration));
int fieldsCount = seaTunnelRowType.getTotalFields();
GenericData dataModel = new GenericData();
dataModel.addLogicalTypeConversion(new Conversions.DecimalConversion());
dataModel.addLogicalTypeConversion(new TimeConversions.DateConversion());
dataModel.addLogicalTypeConversion(new TimeConversions.LocalTimestampMillisConversion());
final boolean useSplitRange =
enableSplitFile && split.getStart() >= 0 && split.getLength() > 0;
GenericRecord record;
AvroParquetReader.Builder<GenericData.Record> builder =
AvroParquetReader.<GenericData.Record>builder(hadoopInputFile)
.withDataModel(dataModel);View on GitHub (pinned to cf67b549a7)
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.
Example fix
// before
FaT = { source = { file = { file_format_type = "parquet", path = "/data/mixed" } } }
// after: match only parquet files
path = "/data/mixed/*.parquet" // and confirm magic bytes are PAR1 Defensive patterns
Strategy: validation
Validate before calling
// Verify parquet magic bytes before configuring/reading the path
byte[] head = new byte[4];
try (InputStream in = Files.newInputStream(Paths.get(path))) {
if (in.read(head) != 4 || !Arrays.equals(head, "PAR1".getBytes(StandardCharsets.US_ASCII))) {
throw new IllegalStateException(path + " is not a parquet file");
}
} Try / catch
try {
rows = parquetSource.read();
} catch (FileConnectorException e) {
if (e.getMessage().contains("is not a parquet file")) {
// switch file_format_type or fix the path pattern
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.
Related errors
- FORMAT_NOT_SUPPORT
- File format 'canal_json' does not support reading.
- File format 'debezium_json' does not support reading.
- File format 'maxwell_json' does not support reading.
- File format 'markdown' does not support writing.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/54da27b038d2afec.
Report an issue: GitHub.