{"record":{"id":"8d852830b8ba6ba1","repo":"apache/iceberg","slug":"namespace-does-not-exist-s-8d8528","errorCode":null,"errorMessage":"Namespace does not exist: %s","messagePattern":"Namespace does not exist: (.+?)","errorType":"exception","errorClass":"NoSuchNamespaceException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java","lineNumber":200,"sourceCode":"        LOG.warn(\"Unable to list directory {}\", path, e);\n        return false;\n      } else {\n        throw new UncheckedIOException(e);\n      }\n    }\n  }\n\n  @Override\n  public List<TableIdentifier> listTables(Namespace namespace) {\n    Preconditions.checkArgument(\n        namespace.levels().length >= 1, \"Missing database in table identifier: %s\", namespace);\n\n    Path nsPath = new Path(warehouseLocation, SLASH.join(namespace.levels()));\n    Set<TableIdentifier> tblIdents = Sets.newHashSet();\n\n    try {\n      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    }","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java#L182-L218","documentation":"HadoopCatalog.listTables(namespace) resolves the namespace to a directory under the warehouse location; if that directory does not exist on the filesystem it throws NoSuchNamespaceException. This is the catalog's way of reporting that the namespace (database) has never been created or was removed.","triggerScenarios":"Calling listTables on a namespace whose directory is absent under warehouseLocation — typo'd namespace levels, namespace never created via createNamespace, or a moved/reconfigured warehouseLocation.","commonSituations":"warehouseLocation changed in catalog config so existing namespaces resolve to new paths; case-sensitivity mismatches (HDFS/S3 paths are case-sensitive); namespace deleted by another job; typo in namespace string.","solutions":["Verify the namespace exists: catalog.listNamespaces() or create it with catalog.createNamespace(namespace) if missing.","Check for typos and case mismatches in the namespace levels.","Confirm warehouseLocation in the HadoopCatalog configuration still points to the original warehouse root.","If the namespace was deleted, recreate it before listing tables."],"exampleFix":"// before\nList<TableIdentifier> tables = catalog.listTables(TableIdentifier.of(\"db\")); // NoSuchNamespaceException\n// after\nif (!catalog.namespaceExists(TableIdentifier.of(\"db\"))) {\n  catalog.createNamespace(TableIdentifier.of(\"db\"));\n}\nList<TableIdentifier> tables = catalog.listTables(TableIdentifier.of(\"db\"));","handlingStrategy":"validation","validationCode":"boolean exists = catalog.listNamespaces().stream()\n    .anyMatch(ns -> ns.equals(namespace));\nif (!exists) catalog.createNamespace(namespace);","typeGuard":null,"tryCatchPattern":"try {\n  return catalog.listTables(namespace);\n} catch (NoSuchNamespaceException e) {\n  LOG.warn(\"namespace {} not found under current warehouseLocation\", namespace);\n  throw e;\n}","preventionTips":["Create namespaces with createNamespace before listing tables.","Verify warehouseLocation config matches the environment where namespaces were created.","Remember HDFS/S3 paths are case-sensitive; match namespace case exactly.","Check for namespace deletion by concurrent jobs."],"tags":["hadoop-catalog","namespace","filesystem","resource-not-found"],"backgroundTag":"entity-not-found","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"}