apache/seatunnel · error · FileConnectorException

FILE_TYPE_INVALID

FILE_TYPE_INVALID

Error message

Check orc file [%s] failed

What it means

checkFileType() reads the file's first bytes and compares them to the ORC magic string; if that probing read throws an IOException it is wrapped as FILE_TYPE_INVALID with 'Check orc file [%s] failed'. Unlike the plain not-an-orc case (1124), the exception carries the IO cause, so it usually indicates a filesystem-level problem rather than a wrong format.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/OrcReadStrategy.java:242

            }
            int offset = buffer.arrayOffset() + buffer.position() + buffer.limit() - 1 - len;
            byte[] array = buffer.array();
            if (Text.decode(array, offset, len).equals(OrcFile.MAGIC)) {
                checkResult = true;
            } else {
                // If it isn't there, this may be the 0.11.0 version of ORC.
                // Read the first 3 bytes of the file to check for the header
                in.seek(0);
                byte[] header = new byte[len];
                in.readFully(header, 0, len);
                // if it isn't there, this isn't an ORC file
                checkResult = Text.decode(header, 0, len).equals(OrcFile.MAGIC);
            }
            in.close();
            return checkResult;
        } catch (IOException e) {
            String errorMsg = String.format("Check orc file [%s] failed", path);
            throw new FileConnectorException(FileConnectorErrorCode.FILE_TYPE_INVALID, errorMsg, e);
        }
    }

    private SeaTunnelDataType<?> getFinalType(
            SeaTunnelDataType<?> fileType, SeaTunnelDataType<?> configType) {
        if (configType == null) {
            return fileType;
        }
        return canConvert(fileType, configType) ? configType : fileType;
    }

    private SeaTunnelDataType<?> orcDataType2SeaTunnelDataType(
            TypeDescription typeDescription, SeaTunnelDataType<?> configType) {
        switch (typeDescription.getCategory()) {
            case BOOLEAN:
                return getFinalType(BasicType.BOOLEAN_TYPE, configType);
            case INT:
                return getFinalType(BasicType.INT_TYPE, configType);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the cause to determine whether it is IO/auth/EOF and fix the filesystem access.
  2. Verify the file exists and is at least a few bytes at the exact path in the message.
  3. Check read permissions and storage credentials in the runtime environment.
  4. Regenerate the file if it was truncated or empty.

Example fix

// before: empty file at path
// after: recreate file or skip empty files in path filter
Files.size(path) > 3 // ensure header bytes exist before read
Defensive patterns

Strategy: try-catch

Validate before calling

Files.exists(path) && Files.size(path) > 3 // header bytes must exist

Type guard

function readableOrcCandidate(path) { return Files.isRegularFile(path) && Files.size(path) >= 3; }

Try / catch

try { strategy.read(path); } catch (FileConnectorException e) { if (e.getMessage().startsWith("Check orc file")) { log.error("Header probe failed for {}:", path, e.getCause()); } throw e; }

Prevention

When it happens

Trigger: checkFileType(path) failing to open/read the header bytes: missing file, no read permission, network failure to object storage, or premature EOF on a tiny/empty file.

Common situations: Path deleted after split enumeration; credentials missing for S3/HDFS; unreadable file permissions; zero-byte or 1-2 byte file shorter than the ORC magic string.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/ca0ab042386bfda8. Report an issue: GitHub.