apache/seatunnel · error · FileConnectorException
FileConnectorErrorCode.FILE_TYPE_INVALID
FileConnectorErrorCode.FILE_TYPE_INVALID
Error message
This file [%s] is not a orc file, please check the format of this file
What it means
OrcReadStrategy.read() verifies the file actually has the ORC magic header before opening it. When checkFileType returns false, the file is not a valid ORC file and reading is aborted with FILE_TYPE_INVALID. This guards against feeding mislabeled or corrupt files to the ORC reader.
Source
Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/OrcReadStrategy.java:92
import java.util.List;
import java.util.Map;
import static org.apache.seatunnel.api.table.type.TypeUtil.canConvert;
import static org.apache.seatunnel.connectors.seatunnel.file.sink.writer.OrcWriteStrategy.buildFieldWithRowType;
@Slf4j
public class OrcReadStrategy extends AbstractReadStrategy {
private static final long MIN_SIZE = 16 * 1024;
@Override
public void read(String path, String tableId, Collector<SeaTunnelRow> output)
throws FileConnectorException, IOException {
if (Boolean.FALSE.equals(checkFileType(path))) {
String errorMsg =
String.format(
"This file [%s] is not a orc file, please check the format of this file",
path);
throw new FileConnectorException(FileConnectorErrorCode.FILE_TYPE_INVALID, errorMsg);
}
Charset charset = StandardCharsets.UTF_8;
if (pluginConfig != null) {
charset =
ReadonlyConfig.fromConfig(pluginConfig)
.getOptional(FileBaseSourceOptions.ENCODING)
.map(Charset::forName)
.orElse(StandardCharsets.UTF_8);
}
Map<String, String> partitionsMap = parsePartitionsByPath(path);
try (Reader reader =
hadoopFileSystemProxy.doWithHadoopAuth(
(configuration, userGroupInformation) -> {
OrcFile.ReaderOptions readerOptions =
OrcFile.readerOptions(configuration);
return OrcFile.createReader(new Path(path), readerOptions);View on GitHub (pinned to cf67b549a7)
Solutions
- Check the file's header bytes (should start with 'ORC') to confirm its real format.
- Correct the file_type in the source config to match the actual file format (e.g. text/parquet).
- Remove or regenerate the corrupt/mislabeled file.
- Re-run the upstream writer if the file was truncated mid-write.
Example fix
// before file_format_type = orc # file is actually parquet // after file_format_type = parquet
Defensive patterns
Strategy: validation
Validate before calling
// check ORC magic before configuring source head -c 3 file.orc # must print 'ORC'
Type guard
function looksLikeOrc(bytes) { return bytes.length >= 3 && bytes[0]===0x4F && bytes[1]===0x52 && bytes[2]===0x43; } Try / catch
try { strategy.read(path); } catch (FileConnectorException e) { if (e.getErrorCode() == FileConnectorErrorCode.FILE_TYPE_INVALID) { log.error("{} is not ORC; detect actual format", path); } throw e; } Prevention
- Match file_type in config to the actual on-disk format
- Keep different formats in separate directories
- Verify uploads completed before ingesting files
- Sample file headers when onboarding new data sources
When it happens
Trigger: Calling OrcReadStrategy.read(path) on a file whose first bytes are not 'ORC' (plain text/JSON/CSV renamed to .orc, empty file, or truncated download).
Common situations: Directory mixes formats but file_type=orc is configured; an upstream job wrote text files into the ORC directory; partial upload left a non-ORC zero-byte file; using FileFormatOption ORC with a path of mixed extensions.
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
- FILE_TYPE_INVALID
- ILLEGAL_ARGUMENT
- SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED
- CommonErrorCodeDeprecated.TABLE_SCHEMA_GET_FAILED
- Json parsing exception.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/3bf3184399ff9ed1.
Report an issue: GitHub.