{"record":{"id":"6b5674f4af30d807","repo":"prestodb/presto","slug":"hive-unknown-error-6b5674","errorCode":"HIVE_UNKNOWN_ERROR","errorMessage":"Error reading from %s at position %s. ","messagePattern":"Error reading from (.+?) at position (.+?)\\. ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/orc/HdfsOrcDataSource.java","lineNumber":79,"sourceCode":"    {\n        try {\n            long readStart = System.nanoTime();\n            inputStream.readFully(position, buffer, bufferOffset, bufferLength);\n            stats.readDataBytesPerSecond(bufferLength, System.nanoTime() - readStart);\n        }\n        catch (PrestoException e) {\n            // just in case there is a Presto wrapper or hook\n            throw e;\n        }\n        catch (Exception e) {\n            String message = format(\"Error reading from %s at position %s. \", this, position);\n            if (e.getClass().getSimpleName().equals(\"BlockMissingException\")) {\n                throw new PrestoException(HIVE_MISSING_DATA, message, e);\n            }\n            if (e instanceof IOException) {\n                throw new PrestoException(HIVE_FILESYSTEM_ERROR, message + e.getMessage(), e);\n            }\n            throw new PrestoException(HIVE_UNKNOWN_ERROR, message, e);\n        }\n    }\n}\n","sourceCodeStart":61,"sourceCodeEnd":83,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/orc/HdfsOrcDataSource.java#L61-L83","documentation":"The final catch-all in HdfsOrcDataSource.readInternal: any exception that is neither BlockMissingException nor an IOException becomes PrestoException(HIVE_UNKNOWN_ERROR) prefixed with 'Error reading from %s at position %s. '. This preserves the original exception as the cause for later diagnosis.","triggerScenarios":"A non-IOException (e.g., RuntimeException, OOM from a huge read buffer, UncheckedIOException variant, security exception) escapes the HDFS read call at the requested position.","commonSituations":"Presto/HDFS client bugs, out-of-memory on workers reading very large columns, Kerberos/token expiry surfacing as unchecked exceptions, misconfigured HDFS settings causing runtime failures.","solutions":["Examine the full stack trace (cause) in the query failure to find the true root exception","Check worker logs and memory pressure; retry on a healthy cluster if transient","Verify HDFS delegation tokens / Kerberos credentials are valid for long-running queries","If reproducible, report with the cause stack trace to the Presto/Hive connector maintainers"],"exampleFix":"// before\nSELECT * FROM t; -- HIVE_UNKNOWN_ERROR: Error reading from ... at position ...\n\n// after (diagnose)\n-- inspect cause stack trace in worker log; renew tokens / increase heap as indicated\nSELECT * FROM t;","handlingStrategy":"try-catch","validationCode":"// precheck cluster health and worker memory before heavy scans\n-- check HDFS delegation token validity for long queries (hdfs gettoken / job conf)","typeGuard":null,"tryCatchPattern":"try {\n    return query(sql);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"HIVE_UNKNOWN_ERROR\")) {\n        logRootCause(e.getCause()); // the original non-IO exception carries the diagnosis\n        throw new RuntimeException(\"ORC read failed; see cause\", e.getCause());\n    }\n    throw e;\n}","preventionTips":["Size worker heaps for the widest ORC columns you scan to avoid OOM during reads","Keep Kerberos/HDFS delegation tokens valid for the query duration (hive.max-delegation-token-requests, token renewal)","Treat the wrapped cause as the real bug and report it with full stack traces","Keep Presto and HDFS client versions aligned/compatible"],"tags":["hdfs","orc","unknown-error","runtime-exception","read"],"backgroundTag":"hdfs-io-error","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}