{"record":{"id":"1c822a813b24e86d","repo":"prestodb/presto","slug":"local-file-read-error","errorCode":"LOCAL_FILE_READ_ERROR","errorMessage":"Error reading file: \" + file.getName()","messagePattern":"Error reading file: \" \\+ file\\.getName\\(\\)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-local-file/src/main/java/com/facebook/presto/localfile/LocalFileRecordCursor.java","lineNumber":308,"sourceCode":"                throws IOException\n        {\n            if (!files.hasNext()) {\n                return null;\n            }\n            File file = files.next();\n            InputStream fileInputStream = Files.newInputStream(file.toPath());\n            InputStream in = isGZipped(file) ? new GZIPInputStream(fileInputStream) : fileInputStream;\n            return new BufferedReader(new InputStreamReader(in));\n        }\n\n        public static boolean isGZipped(File file)\n        {\n            try (RandomAccessFile inputFile = new RandomAccessFile(file, \"r\")) {\n                int magic = inputFile.read() & 0xff | ((inputFile.read() << 8) & 0xff00);\n                return magic == GZIP_MAGIC;\n            }\n            catch (IOException e) {\n                throw new PrestoException(LOCAL_FILE_READ_ERROR, \"Error reading file: \" + file.getName(), e);\n            }\n        }\n\n        public List<String> readFields()\n                throws IOException\n        {\n            List<String> fields = null;\n            boolean newReader = false;\n\n            while (fields == null) {\n                if (reader == null) {\n                    return null;\n                }\n                String line = reader.readLine();\n                if (line != null) {\n                    fields = LINE_SPLITTER.splitToList(line);\n                    if (!newReader || meetsPredicate(fields)) {\n                        return fields;","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-local-file/src/main/java/com/facebook/presto/localfile/LocalFileRecordCursor.java#L290-L326","documentation":"An I/O failure occurred while opening or reading a local file in LocalFileRecordCursor (opening the stream, wrapping it in a GZIP stream, or creating the reader); the offending file name is included. The exception is wrapped rather than silently skipping the file.","triggerScenarios":"Thrown at presto-local-file/src/main/java/com/facebook/presto/localfile/LocalFileRecordCursor.java:308 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the named file exists and is readable by the Presto process","If the file is expected to be gzipped, verify it is not truncated or corrupt"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}