{"record":{"id":"ed35b7e363f6428f","repo":"apache/iceberg","slug":"failed-to-list-tables-under-s","errorCode":null,"errorMessage":"Failed to list tables under: %s","messagePattern":"Failed to list tables under: (.+?)","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java","lineNumber":217,"sourceCode":"      if (!isDirectory(nsPath)) {\n        throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n      }\n      RemoteIterator<FileStatus> it = fs.listStatusIterator(nsPath);\n      while (it.hasNext()) {\n        FileStatus status = it.next();\n        if (!status.isDirectory()) {\n          // Ignore the path which is not a directory.\n          continue;\n        }\n\n        Path path = status.getPath();\n        if (isTableDir(path)) {\n          TableIdentifier tblIdent = TableIdentifier.of(namespace, path.getName());\n          tblIdents.add(tblIdent);\n        }\n      }\n    } catch (IOException ioe) {\n      throw new RuntimeIOException(ioe, \"Failed to list tables under: %s\", namespace);\n    }\n\n    return Lists.newArrayList(tblIdents);\n  }\n\n  @Override\n  protected boolean isValidIdentifier(TableIdentifier identifier) {\n    return true;\n  }\n\n  @Override\n  protected TableOperations newTableOps(TableIdentifier identifier) {\n    return new HadoopTableOperations(\n        new Path(defaultWarehouseLocation(identifier)), fileIO, conf, lockManager);\n  }\n\n  @Override\n  protected String defaultWarehouseLocation(TableIdentifier tableIdentifier) {","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L199-L235","documentation":"HadoopCatalog.listTables wraps IOExceptions from the underlying FileSystem directory listing into a RuntimeIOException. It means the directory-iteration over the namespace's warehouse path failed (I/O-level, not a missing namespace, which throws NoSuchNamespaceException instead). The original IOException is preserved as the cause.","triggerScenarios":"Calling catalog.listTables(namespace) when fs.listStatusIterator(nsPath) throws IOException: HDFS NameNode unreachable, S3/ADLS object-store list failure, credentials expired mid-listing, or a transient network error while iterating the RemoteIterator.","commonSituations":"Misconfigured warehouse location (wrong filesystem scheme, e.g. missing hdfs:// namenode host), HDFS cluster down or in safe mode, expired cloud credentials (S3/ADLS/GCS), network partitions, or wrong core-site/fs config in the Hadoop conf passed to the catalog.","solutions":["Check the underlying IOException cause to see if it is connectivity, permissions, or a bad path.","Verify the warehouse location URI scheme and host are reachable (e.g. hdfs://nn:8020 or s3a://bucket) from this client.","Validate Hadoop/FileSystem configuration (core-site.xml, hdfs-site.xml, cloud credential providers) in the Configuration given to HadoopCatalog.","Retry on transient errors; for cloud stores verify credentials haven't expired.","Confirm the namespace directory exists via listNamespaces before listing tables."],"exampleFix":"// before: listing with unverified cluster\nList<TableIdentifier> tables = catalog.listTables(Namespace.of(\"db\"));\n\n// after: pre-check namespace and catch I/O failure\ntry {\n  if (!catalog.namespaceExists(Namespace.of(\"db\"))) {\n    throw new IllegalStateException(\"Namespace db missing\");\n  }\n  List<TableIdentifier> tables = catalog.listTables(Namespace.of(\"db\"));\n} catch (RuntimeIOException e) {\n  LOG.error(\"Filesystem listing failed; check warehouse URI and connectivity\", e);\n}","handlingStrategy":"try-catch","validationCode":"if (!catalog.namespaceExists(namespace)) { throw new IllegalArgumentException(\"Namespace missing: \" + namespace); }","typeGuard":null,"tryCatchPattern":"try { catalog.listTables(ns); } catch (RuntimeIOException e) { // inspect e.getCause() IOException; retry or fail with context }","preventionTips":["Validate warehouse URI reachability at startup","Keep cloud credentials refreshed before long jobs","Pre-check namespace existence before listing"],"tags":["io","filesystem","hadoop","catalog","listing"],"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-14T16:17:12.679Z"}