{"record":{"id":"7bd63c0474787139","repo":"prestodb/presto","slug":"hive-cursor-error-7bd63c","errorCode":"HIVE_CURSOR_ERROR","errorMessage":"Failed to read RC file: %s","messagePattern":"Failed to read RC file: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSource.java","lineNumber":164,"sourceCode":"                }\n                else {\n                    blocks[fieldId] = createBlock(currentPageSize, fieldId);\n                }\n            }\n\n            return new Page(currentPageSize, blocks);\n        }\n        catch (PrestoException e) {\n            closeWithSuppression(e);\n            throw e;\n        }\n        catch (RcFileCorruptionException e) {\n            closeWithSuppression(e);\n            throw new PrestoException(HIVE_BAD_DATA, format(\"Corrupted RC file: %s\", rcFileReader.getId()), e);\n        }\n        catch (IOException | RuntimeException e) {\n            closeWithSuppression(e);\n            throw new PrestoException(HIVE_CURSOR_ERROR, format(\"Failed to read RC file: %s\", rcFileReader.getId()), e);\n        }\n    }\n\n    @Override\n    public void close()\n            throws IOException\n    {\n        // some hive input formats are broken and bad things can happen if you close them multiple times\n        if (closed) {\n            return;\n        }\n        closed = true;\n\n        rcFileReader.close();\n    }\n\n    @Override\n    public String toString()","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/rcfile/RcFilePageSource.java#L146-L182","documentation":"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.","triggerScenarios":"rcFileReader.readBlock / next() inside getNextPage throws IOException (HDFS read timeout, EOF, decompressor failure) or any RuntimeException not classified as corruption.","commonSituations":"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.","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."],"exampleFix":"// before: native codec missing on workers -> IO/decompress failure\n// after: install/configure the codec, e.g. for LZO:\n// hive.lzo.native.lib.path=/usr/lib/hadoop/lib/native (worker config)\n// then rerun the query","handlingStrategy":"retry","validationCode":"// Precheck storage availability before submitting a long scan\nFileSystem fs = path.getFileSystem(conf);\nif (!fs.exists(path)) throw new PrestoException(HIVE_BAD_DATA, \"Missing file: \" + path);\n// Confirm the file's codec is on the classpath of workers:\n// Class.forName(codecClassName) in a setup job, or check worker config for native lib path","typeGuard":null,"tryCatchPattern":"int attempts = 0;\nwhile (true) {\n    try {\n        return pageSource.getNextPage();\n    } catch (PrestoException e) {\n        if (e.getErrorCode() == HIVE_CURSOR_ERROR.toErrorCode() && attempts++ < 3) {\n            Thread.sleep(1000L * attempts); // transient HDFS IO — retry\n            continue;\n        }\n        throw e;\n    }\n}","preventionTips":["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."],"tags":["hive","rcfile","io-error","hdfs"],"backgroundTag":"hdfs-read-failure","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"}