{"record":{"id":"00847eea40316983","repo":"prestodb/presto","slug":"hive-filesystem-error","errorCode":"HIVE_FILESYSTEM_ERROR","errorMessage":"Failed getting FileSystem: ","messagePattern":"Failed getting FileSystem: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/GenericHiveRecordCursorProvider.java","lineNumber":74,"sourceCode":"            DateTimeZone hiveStorageTimeZone,\n            TypeManager typeManager,\n            boolean s3SelectPushdownEnabled)\n    {\n        // make sure the FileSystem is created with the proper Configuration object\n        Path path = new Path(fileSplit.getPath());\n        try {\n            if (!fileSplit.getCustomSplitInfo().isEmpty()) {\n                if (configuration instanceof HiveCachingHdfsConfiguration.CachingJobConf) {\n                    configuration = ((HiveCachingHdfsConfiguration.CachingJobConf) configuration).getConfig();\n                }\n                if (configuration instanceof CopyOnFirstWriteConfiguration) {\n                    configuration = ((CopyOnFirstWriteConfiguration) configuration).getConfig();\n                }\n            }\n            this.hdfsEnvironment.getFileSystem(session.getUser(), path, configuration);\n        }\n        catch (IOException e) {\n            throw new PrestoException(HIVE_FILESYSTEM_ERROR, \"Failed getting FileSystem: \" + path, e);\n        }\n\n        Configuration actualConfiguration = configuration;\n\n        RecordReader<?, ?> recordReader = hdfsEnvironment.doAs(session.getUser(),\n                () -> HiveUtil.createRecordReader(actualConfiguration, path, fileSplit.getStart(), fileSplit.getLength(), schema, columns, fileSplit.getCustomSplitInfo()));\n        return hdfsEnvironment.doAs(session.getUser(),\n                () -> Optional.of(new GenericHiveRecordCursor<>(\n                        session,\n                        actualConfiguration,\n                        path,\n                        genericRecordReader(recordReader),\n                        fileSplit.getLength(),\n                        schema,\n                        columns,\n                        hiveStorageTimeZone,\n                        typeManager)));\n    }","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/GenericHiveRecordCursorProvider.java#L56-L92","documentation":"GenericHiveRecordCursorProvider.createRecordCursor calls hdfsEnvironment.getFileSystem(...) to validate that a FileSystem can be obtained for the split's path before creating the RecordReader. Any IOException there is wrapped as a PrestoException with HIVE_FILESYSTEM_ERROR, meaning Presto could not access the underlying file system (HDFS, S3, Azure, etc.) for this file.","triggerScenarios":"hdfsEnvironment.getFileSystem(session.getUser(), path, configuration) throws IOException while preparing a record cursor for a Hive split — e.g. bad NameNode URI, missing/wrong filesystem scheme, Kerberos/token failures surfaced as IOException, or unresolvable HDFS host.","commonSituations":"HDFS NameNode down or moved (stale table location); S3 credentials/bucket misconfiguration; unknown host in hdfs:// URI; permission or Kerberos issues; file deleted between split scheduling and reading; configs without the scheme's FileSystem implementation on the classpath.","solutions":["Verify the table/partition location URI is reachable: check the NameNode is up and the host:port in the path resolves.","Confirm the filesystem scheme is supported and configured (fs.defaultFS, fs.hdfs.impl, or S3 endpoint/credentials in the connector properties).","Check permissions/Kerberos: ensure the Presto user can access the path and tokens are valid (retry after re-authentication).","Confirm the file still exists; if the location was moved, update the table/partition metadata (e.g. ALTER TABLE ... SET LOCATION or MSCK REPAIR).","Inspect the wrapped cause in the PrestoException for the root IOException and address it specifically."],"exampleFix":"// before (table points at dead NameNode)\nLOCATION 'hdfs://old-nn:9000/warehouse/orders';\n// after\nALTER TABLE orders SET LOCATION 'hdfs://new-nn:8020/warehouse/orders';","handlingStrategy":"try-catch","validationCode":"// check the table location is reachable before querying\nPath path = new Path(tableLocation);\nFileSystem fs = path.getFileSystem(conf);\nif (!fs.exists(path)) {\n    throw new IllegalStateException(\"Location missing: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return cursorProvider.createRecordCursor(...);\n} catch (PrestoException e) {\n    if (HIVE_FILESYSTEM_ERROR.toErrorCode().equals(e.getErrorCode())) {\n        // inspect e.getCause() (IOException) for NameNode/S3/Kerberos root cause\n        throw new RuntimeException(\"Hive filesystem unavailable for \" + path, e);\n    }\n    throw e;\n}","preventionTips":["Monitor NameNode and storage endpoint health from Presto worker hosts.","Keep table/partition locations in sync with cluster topology; update after NameNode moves or decommissions.","Validate Kerberos keytabs and S3 credentials in worker configs; run periodic connectivity checks (hdfs dfs -ls) as the Presto user."],"tags":["presto","hive","hdfs","filesystem","io"],"backgroundTag":"filesystem-access-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"}