{"record":{"id":"04fe1c9fc9daa7ad","repo":"prestodb/presto","slug":"iceberg-filesystem-error-04fe1c","errorCode":"ICEBERG_FILESYSTEM_ERROR","errorMessage":"Error getting file system at path %s","messagePattern":"Error getting file system at path (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/procedure/RegisterTableProcedure.java","lineNumber":138,"sourceCode":"                        metadataDirectory));\n\n        metadata.registerTable(clientSession, schemaTableName, metadataPath, deleteDataOnDrop);\n    }\n\n    public static FileSystem getFileSystem(ConnectorSession clientSession, HdfsEnvironment hdfsEnvironment, SchemaTableName schemaTableName, Path location)\n    {\n        HdfsContext hdfsContext = new HdfsContext(\n                clientSession,\n                schemaTableName.getSchemaName(),\n                schemaTableName.getTableName(),\n                location.getName(),\n                true);\n\n        try {\n            return hdfsEnvironment.getFileSystem(hdfsContext, location);\n        }\n        catch (Exception e) {\n            throw new PrestoException(ICEBERG_FILESYSTEM_ERROR, format(\"Error getting file system at path %s\", location), e);\n        }\n    }\n\n    public static Path resolveLatestMetadataLocation(ConnectorSession clientSession, FileSystem fileSystem, Path metadataPath)\n    {\n        int maxVersion = -1;\n        long lastModifiedTime = -1;\n        Path metadataFile = null;\n        boolean duplicateVersions = false;\n\n        try {\n            FileStatus[] files = fileSystem.listStatus(metadataPath, name -> name.getName().contains(METADATA_FILE_EXTENSION));\n            for (FileStatus file : files) {\n                int version = parseMetadataVersionFromFileName(file.getPath().getName());\n                if (version > maxVersion) {\n                    maxVersion = version;\n                    metadataFile = file.getPath();\n                    lastModifiedTime = file.getModificationTime();","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/procedure/RegisterTableProcedure.java#L120-L156","documentation":"ICEBERG_FILESYSTEM_ERROR thrown by RegisterTableProcedure.getFileSystem when HdfsEnvironment.getFileSystem fails while obtaining a FileSystem handle for the table location during table registration. It wraps any underlying Hadoop/IO exception (missing HDFS config, bad scheme, auth failure) with the offending path in the message.","triggerScenarios":"Calling the register_table procedure whose metadataPath() invokes getFileSystem on a location where HDFS environment setup fails — e.g. invalid URI scheme, missing hdfs-site/core-site config, or Kerberos/token failure in HdfsContext.","commonSituations":"Registering an Iceberg table from a location on a filesystem not configured in the Presto Hadoop environment; expired Kerberos TGT/delegation token; location URI typo (s3a vs s3, wrong namenode host); HDFS NameNode down.","solutions":["Check the location URI scheme and host — ensure the Presto cluster's HDFS/Hive configuration (core-site.xml, hdfs-site.xml) covers it","Verify Kerberos credentials/tokens for the Presto process are valid and refreshed","Confirm the NameNode / object store endpoint is reachable from all worker nodes","Inspect the wrapped cause (e) in the Presto logs for the actual filesystem error"],"exampleFix":"// before\nString location = \"/user/hive/warehouse/tbl\"; // no scheme\n// after\nString location = \"hdfs://nameservice1/user/hive/warehouse/tbl\"; // fully-qualified URI","handlingStrategy":"try-catch","validationCode":"// Validate the location URI is fully qualified and the scheme is configured\njava.net.URI uri = java.net.URI.create(location);\nif (uri.getScheme() == null || uri.getAuthority() == null) {\n    throw new IllegalArgumentException(\"Location must be fully qualified: \" + location);\n}","typeGuard":"boolean isSupportedLocation(String location) {\n    String scheme = java.net.URI.create(location).getScheme();\n    return scheme != null && (scheme.equals(\"hdfs\") || scheme.equals(\"s3a\") || scheme.equals(\"abfs\") || scheme.equals(\"abfss\") || scheme.equals(\"file\"));\n}","tryCatchPattern":"try {\n    CALL register_table procedure\n} catch (PrestoException e) {\n    if (\"ICEBERG_FILESYSTEM_ERROR\".equals(e.getErrorCode().getName())) {\n        // inspect e.getCause() for Hadoop-level failure; fix config/URI then retry\n    }\n}","preventionTips":["Always pass fully-qualified URIs (scheme + authority) as table_location","Keep core-site.xml/hdfs-site.xml and object-store credentials consistent across coordinator and workers","Monitor Kerberos ticket/token expiry on long-running clusters","Test filesystem access to the metadata path with the Presto service user before registering"],"tags":["hdfs","iceberg","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"}