{"record":{"id":"493d380820754104","repo":"apache/iceberg","slug":"failed-to-get-file-system-for-path-s","errorCode":null,"errorMessage":"Failed to get file system for path: %s","messagePattern":"Failed to get file system for path: (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/hadoop/Util.java","lineNumber":57,"sourceCode":"import org.apache.iceberg.relocated.com.google.common.collect.Sets;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class Util {\n\n  public static final String VERSION_HINT_FILENAME = \"version-hint.text\";\n\n  private static final Set<String> LOCALITY_WHITELIST_FS = ImmutableSet.of(\"hdfs\");\n\n  private static final Logger LOG = LoggerFactory.getLogger(Util.class);\n\n  private Util() {}\n\n  public static FileSystem getFs(Path path, Configuration conf) {\n    try {\n      return path.getFileSystem(conf);\n    } catch (IOException e) {\n      throw new RuntimeIOException(e, \"Failed to get file system for path: %s\", path);\n    }\n  }\n\n  public static String[] blockLocations(ScanTaskGroup<FileScanTask> taskGroup, Configuration conf) {\n    Set<String> locationSets = Sets.newHashSet();\n    for (FileScanTask f : taskGroup.tasks()) {\n      Path path = new Path(f.file().location());\n      try {\n        FileSystem fs = path.getFileSystem(conf);\n        for (BlockLocation b : fs.getFileBlockLocations(path, f.start(), f.length())) {\n          locationSets.addAll(Arrays.asList(b.getHosts()));\n        }\n      } catch (IOException ioe) {\n        LOG.warn(\"Failed to get block locations for path {}\", path, ioe);\n      }\n    }\n\n    return locationSets.toArray(new String[0]);","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/Util.java#L39-L75","documentation":"Util.getFs wraps Path.getFileSystem failures in RuntimeIOException with this message. It obtains a Hadoop FileSystem for a path using the given Configuration; I/O failures resolving or connecting to the file system trigger it.","triggerScenarios":"Calling Util.getFs(path, conf) where the path scheme has no configured FileSystem implementation, or the underlying Hadoop FS client throws IOException (e.g. connection failure to HDFS/Namenode, bad core-site config).","commonSituations":"Missing Hadoop configuration files (core-site.xml/hdfs-site.xml) on the classpath; wrong URI scheme (e.g. s3a without s3a impl on classpath); NameNode unreachable.","solutions":["Verify the path URI scheme matches a configured FileSystem in the Hadoop Configuration","Ensure Hadoop config files are on the classpath and point to the right cluster","Check the storage endpoint (Namenode/S3 endpoint) is reachable","Confirm required filesystem connector jars (e.g. aws-java-sdk, hdfs client) are present"],"exampleFix":"// before\nFileSystem fs = Util.getFs(new Path(\"s3a://bucket/table\"), new Configuration());\n// after\nConfiguration conf = new Configuration();\nconf.addResource(new Path(\"/etc/hadoop/conf/core-site.xml\"));\nFileSystem fs = Util.getFs(new Path(\"s3a://bucket/table\"), conf);","handlingStrategy":"try-catch","validationCode":"// Ensure the path scheme is supported and Hadoop conf resources are loaded before calling\nConfiguration conf = new Configuration();\nconf.addResource(new Path(\"/etc/hadoop/conf/core-site.xml\"));","typeGuard":null,"tryCatchPattern":"try { FileSystem fs = Util.getFs(path, conf); } catch (RuntimeIOException e) { log.error(\"Cannot resolve FS for {}: {}\", path, e.getMessage()); throw e; }","preventionTips":["Validate path URI scheme against available FileSystem implementations","Ship correct core-site.xml/hdfs-site.xml with the application","Test FS resolution early at startup, not at scan time","Verify storage endpoints are reachable from the runtime environment"],"tags":["hadoop","filesystem","io"],"backgroundTag":"file-read-failed","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}