prestodb/presto · error · PrestoException

LOCAL_FILE_READ_ERROR

LOCAL_FILE_READ_ERROR

Error message

Error reading file: " + file.getName()

What it means

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.

Source

Thrown at presto-local-file/src/main/java/com/facebook/presto/localfile/LocalFileRecordCursor.java:308

                throws IOException
        {
            if (!files.hasNext()) {
                return null;
            }
            File file = files.next();
            InputStream fileInputStream = Files.newInputStream(file.toPath());
            InputStream in = isGZipped(file) ? new GZIPInputStream(fileInputStream) : fileInputStream;
            return new BufferedReader(new InputStreamReader(in));
        }

        public static boolean isGZipped(File file)
        {
            try (RandomAccessFile inputFile = new RandomAccessFile(file, "r")) {
                int magic = inputFile.read() & 0xff | ((inputFile.read() << 8) & 0xff00);
                return magic == GZIP_MAGIC;
            }
            catch (IOException e) {
                throw new PrestoException(LOCAL_FILE_READ_ERROR, "Error reading file: " + file.getName(), e);
            }
        }

        public List<String> readFields()
                throws IOException
        {
            List<String> fields = null;
            boolean newReader = false;

            while (fields == null) {
                if (reader == null) {
                    return null;
                }
                String line = reader.readLine();
                if (line != null) {
                    fields = LINE_SPLITTER.splitToList(line);
                    if (!newReader || meetsPredicate(fields)) {
                        return fields;

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check the named file exists and is readable by the Presto process
  2. If the file is expected to be gzipped, verify it is not truncated or corrupt
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at presto-local-file/src/main/java/com/facebook/presto/localfile/LocalFileRecordCursor.java:308 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/1c822a813b24e86d. Report an issue: GitHub.