{"record":{"id":"45ca0247461af3bc","repo":"prestodb/presto","slug":"hive-filesystem-error-45ca02","errorCode":"HIVE_FILESYSTEM_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":77,"sourceCode":"    @Override\n    protected void readInternal(long position, byte[] buffer, int bufferOffset, int bufferLength)\n    {\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":59,"sourceCodeEnd":83,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/orc/HdfsOrcDataSource.java#L59-L83","documentation":"In HdfsOrcDataSource.readInternal, a generic IOException (anything that is not BlockMissingException) during an ORC read is wrapped into PrestoException(HIVE_FILESYSTEM_ERROR) with a message including the data source and position plus the underlying IOException message. It signals a filesystem-level I/O failure rather than missing data.","triggerScenarios":"read() at `position` throws IOException subclasses like EOFException, FileNotFoundException, or local-RPC/socket errors that are not BlockMissingException.","commonSituations":"File deleted/truncated while the query runs; HDFS client timeouts under heavy load; permission/AuthException on the file; network partitions between Presto worker and datanode; split pointing at a path that no longer exists (partition overwritten mid-query).","solutions":["Inspect the wrapped cause message to identify the exact IOException (EOF vs file-not-found vs timeout)","Verify the file still exists and is intact: hadoop fs -ls / -cat / fsck on the path","Check network/datanode connectivity from the Presto worker and HDFS client timeouts (dfs.client.socket-timeout)","Re-run the query once the filesystem issue is fixed; avoid overwriting tables while queries read them"],"exampleFix":"// before\nSELECT * FROM t; -- HIVE_FILESYSTEM_ERROR: Error reading from ... at position ...\n\n// after (verify then retry)\n-- hadoop fs -ls /warehouse/t/part-0  # confirm exists and non-zero\nSELECT * FROM t;","handlingStrategy":"retry","validationCode":"# confirm the file exists and is readable before/at query time\nhadoop fs -test -e /warehouse/t/part-0 && hadoop fs -du -h /warehouse/t/part-0","typeGuard":null,"tryCatchPattern":"try {\n    return query(sql);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"HIVE_FILESYSTEM_ERROR\")) {\n        // transient IO: bounded retry; permanent issues need the wrapped cause fixed\n        return withRetry(sql, 3, backoffWithJitter());\n    }\n    throw e;\n}","preventionTips":["Do not overwrite/rewrite table files while queries are running","Tune dfs.client socket/read timeouts for large sequential ORC reads","Verify Presto workers have network paths and permissions to all datanodes","Check the wrapped cause message (after the prefix) to classify EOF vs not-found vs timeout"],"tags":["hdfs","orc","ioexception","filesystem","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-11T21:17:09.523Z"}