{"record":{"id":"127a44a488ba63ba","repo":"apache/iceberg","slug":"namespace-does-not-exist-s","errorCode":null,"errorMessage":"Namespace does not exist: %s","messagePattern":"Namespace does not exist: (.+?)","errorType":"exception","errorClass":"NoSuchNamespaceException","httpStatus":null,"severity":"error","filePath":"bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreCatalog.java","lineNumber":217,"sourceCode":"  }\n\n  @Override\n  public List<Namespace> listNamespaces() {\n    try {\n      return listNamespaces(Namespace.empty());\n    } catch (NoSuchNamespaceException e) {\n      return ImmutableList.of();\n    }\n  }\n\n  /**\n   * Since this catalog only supports one-level namespaces, it always returns an empty list unless\n   * passed an empty namespace to list all namespaces within the catalog.\n   */\n  @Override\n  public List<Namespace> listNamespaces(Namespace namespace) {\n    if (!namespace.isEmpty()) {\n      throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n    }\n\n    List<Datasets> allDatasets = client.list(projectId);\n\n    ImmutableList<Namespace> namespaces =\n        allDatasets.stream().map(this::toNamespace).collect(ImmutableList.toImmutableList());\n\n    if (namespaces.isEmpty()) {\n      throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n    }\n\n    return namespaces;\n  }\n\n  @Override\n  public boolean dropNamespace(Namespace namespace) {\n    try {\n      client.delete(toDatasetReference(namespace));","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreCatalog.java#L199-L235","documentation":"listNamespaces(Namespace) in BigQueryMetastoreCatalog only supports listing the single level of datasets: it requires an empty namespace argument (listing all datasets). Passing any non-empty namespace throws NoSuchNamespaceException because nested namespaces do not exist in this catalog.","triggerScenarios":"Calling catalog.listNamespaces(Namespace.of(\"someDataset\")) or any engine API that lists the children of a named namespace.","commonSituations":"Engine metadata browsing that tries to list sub-namespaces of a dataset; code ported from catalogs (e.g. JDBC/Hive) that support hierarchical namespaces.","solutions":["Call listNamespaces() with no arguments (empty namespace) to list all datasets.","Treat the catalog as single-level: list tables within a dataset via listTables instead of listing sub-namespaces.","Filter engine namespace exploration logic to not recurse into namespaces for this catalog."],"exampleFix":"// before\nList<Namespace> ns = catalog.listNamespaces(Namespace.of(\"myDataset\"));\n// after\nList<Namespace> ns = catalog.listNamespaces(); // all datasets in the catalog\nList<TableIdentifier> tables = catalog.listTables(Namespace.of(\"myDataset\"));","handlingStrategy":"validation","validationCode":"if (!namespace.isEmpty()) { throw new IllegalArgumentException(\"BigQuery catalog supports only single-level namespaces; call listNamespaces() with no arguments\"); }","typeGuard":null,"tryCatchPattern":"try { namespaces = catalog.listNamespaces(ns); } catch (NoSuchNamespaceException e) { namespaces = catalog.listNamespaces(); }","preventionTips":["Always call listNamespaces() with an empty namespace for this catalog.","Do not recurse into namespaces for BigQuery-backed catalogs.","Use listTables(Namespace) to explore a dataset's contents instead."],"tags":["gcp","bigquery","namespace","catalog"],"backgroundTag":"namespace-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"}