{"record":{"id":"faa3b4389189a760","repo":"prestodb/presto","slug":"validation-failed-faa3b4","errorCode":null,"errorMessage":"Validation failed","messagePattern":"Validation failed","errorType":"exception","errorClass":"RcFileCorruptionException","httpStatus":null,"severity":"error","filePath":"presto-rcfile/src/main/java/com/facebook/presto/rcfile/RcFileReader.java","lineNumber":540,"sourceCode":"        }\n        try (RcFileReader rcFileReader = new RcFileReader(\n                input,\n                encoding,\n                readTypes.build(),\n                codecFactory,\n                0,\n                input.getSize(),\n                new DataSize(8, Unit.MEGABYTE),\n                Optional.of(writeValidation))) {\n            while (rcFileReader.advance() >= 0) {\n                // ignored\n            }\n        }\n        catch (RcFileCorruptionException e) {\n            throw e;\n        }\n        catch (IOException e) {\n            throw new RcFileCorruptionException(e, \"Validation failed\");\n        }\n    }\n\n    private static class Column\n    {\n        private final ColumnEncoding encoding;\n        private final RcFileDecompressor decompressor;\n\n        private BasicSliceInput lengthsInput;\n        private Slice dataBuffer;\n        private int uncompressedDataSize;\n\n        private byte[] decompressedBuffer = new byte[0];\n\n        private boolean compressed;\n\n        private int currentPosition;\n","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-rcfile/src/main/java/com/facebook/presto/rcfile/RcFileReader.java#L522-L558","documentation":"RcFileReader.validateFile reads the file header/footer and column statistics during reader construction. Any IOException encountered while reading (truncated file, checksum failure, network/DFS read error) is wrapped in RcFileCorruptionException with the generic message 'Validation failed', signaling the RCFile is not readable as-is.","triggerScenarios":"Opening an RCFile via RcFileReader when the underlying stream throws IOException during validation — truncated/corrupted file, wrong file (non-RCFile bytes), HDFS/S3 read failures mid-scan.","commonSituations":"Incomplete file uploads to object storage; HDFS block corruption; reading a file whose compression codec bytes disagree with the header; network interruptions when reading remote files.","solutions":["Verify the file is complete and uncorrupted (re-copy or re-download the source file)","Check that the file is genuinely an RCFile with the expected header/magic bytes","Re-run the Hive job that produced the file if the source data was truncated","Catch RcFileCorruptionException and surface a user-facing 'corrupt file' error, possibly skipping the bad file"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before open: verify file exists and size is plausible\nFileStatus st = fs.getFileStatus(path);\nif (st.getLen() < RCFILE_MIN_HEADER_SIZE) { throw new IOException(\"File too small to be RCFile: \" + path); }","typeGuard":null,"tryCatchPattern":"try (RcFileReader r = new RcFileReader(...)) { ... }\ncatch (RcFileCorruptionException e) {\n    log.error(\"RCFile failed validation: %s\", path, e);\n    throw new DataCorruptionException(path, e);\n}","preventionTips":["Validate file integrity (checksums) after copying from remote storage","Ensure writer jobs complete before readers open files","Use sync markers/checksums to detect truncated HDFS blocks","Isolate corrupt files and re-generate rather than retrying reads"],"tags":["rcfile","corruption","io"],"backgroundTag":"file-corruption-detected","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}