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
- Check DataNode/HDFS health and network: 'hdfs fsck' the file and retry the query; transient socket/lease errors usually clear on retry.
- Confirm the compression codec for the file is available and configured (e.g. LZO native libs installed) on the Presto workers.
- Retry the failed task; if persistent, inspect the wrapped cause stack trace in the query UI to identify the underlying IO error.
- Exclude/rewrite the problematic file, and if the failure is a reader bug, capture the cause and file ID and report/upgrade Presto.
- 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
- Monitor DataNode health and network latency; alert on elevated read errors.
- Install and verify all compression codec native libraries on every Presto worker.
- Size queries/splits to avoid HDFS client timeouts on very slow reads.
- Retain the wrapped cause (query UI) to distinguish transient IO from persistent reader bugs.
- Keep Presto updated to pick up RCFile reader fixes.
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.