prestodb/presto · error · PrestoException

HIVE_CURSOR_ERROR

HIVE_CURSOR_ERROR

Error message

Failed to read RC file: %s

What it means

Presto throws HIVE_CURSOR_ERROR with 'Failed to read RC file: <id>' when getNextPage catches an IOException or unexpected RuntimeException from the RCFile reader — anything that is not a clean RcFileCorruptionException. It indicates an I/O or infrastructure-level failure while reading the file (HDFS stream errors, decompression failures, internal reader bugs) rather than provably bad file content.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSource.java:164

                }
                else {
                    blocks[fieldId] = createBlock(currentPageSize, fieldId);
                }
            }

            return new Page(currentPageSize, blocks);
        }
        catch (PrestoException e) {
            closeWithSuppression(e);
            throw e;
        }
        catch (RcFileCorruptionException e) {
            closeWithSuppression(e);
            throw new PrestoException(HIVE_BAD_DATA, format("Corrupted RC file: %s", rcFileReader.getId()), e);
        }
        catch (IOException | RuntimeException e) {
            closeWithSuppression(e);
            throw new PrestoException(HIVE_CURSOR_ERROR, format("Failed to read RC file: %s", rcFileReader.getId()), e);
        }
    }

    @Override
    public void close()
            throws IOException
    {
        // some hive input formats are broken and bad things can happen if you close them multiple times
        if (closed) {
            return;
        }
        closed = true;

        rcFileReader.close();
    }

    @Override
    public String toString()

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check DataNode/HDFS health and network: 'hdfs fsck' the file and retry the query; transient socket/lease errors usually clear on retry.
  2. Confirm the compression codec for the file is available and configured (e.g. LZO native libs installed) on the Presto workers.
  3. Retry the failed task; if persistent, inspect the wrapped cause stack trace in the query UI to identify the underlying IO error.
  4. Exclude/rewrite the problematic file, and if the failure is a reader bug, capture the cause and file ID and report/upgrade Presto.
  5. Increase timeouts or retry limits for the storage layer if scans regularly exceed HDFS client timeouts.

Example fix

// before: native codec missing on workers -> IO/decompress failure
// after: install/configure the codec, e.g. for LZO:
// hive.lzo.native.lib.path=/usr/lib/hadoop/lib/native (worker config)
// then rerun the query
Defensive patterns

Strategy: retry

Validate before calling

// Precheck storage availability before submitting a long scan
FileSystem fs = path.getFileSystem(conf);
if (!fs.exists(path)) throw new PrestoException(HIVE_BAD_DATA, "Missing file: " + path);
// Confirm the file's codec is on the classpath of workers:
// Class.forName(codecClassName) in a setup job, or check worker config for native lib path

Try / catch

int attempts = 0;
while (true) {
    try {
        return pageSource.getNextPage();
    } catch (PrestoException e) {
        if (e.getErrorCode() == HIVE_CURSOR_ERROR.toErrorCode() && attempts++ < 3) {
            Thread.sleep(1000L * attempts); // transient HDFS IO — retry
            continue;
        }
        throw e;
    }
}

Prevention

When it happens

Trigger: rcFileReader.readBlock / next() inside getNextPage throws IOException (HDFS read timeout, EOF, decompressor failure) or any RuntimeException not classified as corruption.

Common situations: HDFS DataNode unavailability or socket timeouts during long scans, block relocation after rebalancing, JVM decompression library (e.g. native zlib/LZO) failures, or genuine Presto reader bugs on unusual files.

Related errors


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