{"record":{"id":"ca0ab042386bfda8","repo":"apache/seatunnel","slug":"file-type-invalid","errorCode":"FILE_TYPE_INVALID","errorMessage":"Check orc file [%s] failed","messagePattern":"Check orc file \\[(.+?)\\] failed","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/OrcReadStrategy.java","lineNumber":242,"sourceCode":"            }\n            int offset = buffer.arrayOffset() + buffer.position() + buffer.limit() - 1 - len;\n            byte[] array = buffer.array();\n            if (Text.decode(array, offset, len).equals(OrcFile.MAGIC)) {\n                checkResult = true;\n            } else {\n                // If it isn't there, this may be the 0.11.0 version of ORC.\n                // Read the first 3 bytes of the file to check for the header\n                in.seek(0);\n                byte[] header = new byte[len];\n                in.readFully(header, 0, len);\n                // if it isn't there, this isn't an ORC file\n                checkResult = Text.decode(header, 0, len).equals(OrcFile.MAGIC);\n            }\n            in.close();\n            return checkResult;\n        } catch (IOException e) {\n            String errorMsg = String.format(\"Check orc file [%s] failed\", path);\n            throw new FileConnectorException(FileConnectorErrorCode.FILE_TYPE_INVALID, errorMsg, e);\n        }\n    }\n\n    private SeaTunnelDataType<?> getFinalType(\n            SeaTunnelDataType<?> fileType, SeaTunnelDataType<?> configType) {\n        if (configType == null) {\n            return fileType;\n        }\n        return canConvert(fileType, configType) ? configType : fileType;\n    }\n\n    private SeaTunnelDataType<?> orcDataType2SeaTunnelDataType(\n            TypeDescription typeDescription, SeaTunnelDataType<?> configType) {\n        switch (typeDescription.getCategory()) {\n            case BOOLEAN:\n                return getFinalType(BasicType.BOOLEAN_TYPE, configType);\n            case INT:\n                return getFinalType(BasicType.INT_TYPE, configType);","sourceCodeStart":224,"sourceCodeEnd":260,"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/OrcReadStrategy.java#L224-L260","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the cause to determine whether it is IO/auth/EOF and fix the filesystem access.","Verify the file exists and is at least a few bytes at the exact path in the message.","Check read permissions and storage credentials in the runtime environment.","Regenerate the file if it was truncated or empty."],"exampleFix":"// before: empty file at path\n// after: recreate file or skip empty files in path filter\nFiles.size(path) > 3 // ensure header bytes exist before read","handlingStrategy":"try-catch","validationCode":"Files.exists(path) && Files.size(path) > 3 // header bytes must exist","typeGuard":"function readableOrcCandidate(path) { return Files.isRegularFile(path) && Files.size(path) >= 3; }","tryCatchPattern":"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; }","preventionTips":["Skip or quarantine empty/tiny files in the source path","Check read permissions and storage credentials","Re-run upstream jobs if files were truncated","Validate file existence at job start, not just split time"],"tags":["orc","file-format","io","file-source"],"backgroundTag":"file-read-failed","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"}