apache/iceberg · error · NoSuchNamespaceException
Namespace does not exist: %s
Error message
Namespace does not exist: %s
What it means
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.
Source
Thrown at bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreCatalog.java:217
}
@Override
public List<Namespace> listNamespaces() {
try {
return listNamespaces(Namespace.empty());
} catch (NoSuchNamespaceException e) {
return ImmutableList.of();
}
}
/**
* Since this catalog only supports one-level namespaces, it always returns an empty list unless
* passed an empty namespace to list all namespaces within the catalog.
*/
@Override
public List<Namespace> listNamespaces(Namespace namespace) {
if (!namespace.isEmpty()) {
throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
}
List<Datasets> allDatasets = client.list(projectId);
ImmutableList<Namespace> namespaces =
allDatasets.stream().map(this::toNamespace).collect(ImmutableList.toImmutableList());
if (namespaces.isEmpty()) {
throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
}
return namespaces;
}
@Override
public boolean dropNamespace(Namespace namespace) {
try {
client.delete(toDatasetReference(namespace));View on GitHub (pinned to 86d9c8fc54)
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.
Example fix
// before
List<Namespace> ns = catalog.listNamespaces(Namespace.of("myDataset"));
// after
List<Namespace> ns = catalog.listNamespaces(); // all datasets in the catalog
List<TableIdentifier> tables = catalog.listTables(Namespace.of("myDataset")); Defensive patterns
Strategy: validation
Validate before calling
if (!namespace.isEmpty()) { throw new IllegalArgumentException("BigQuery catalog supports only single-level namespaces; call listNamespaces() with no arguments"); } Try / catch
try { namespaces = catalog.listNamespaces(ns); } catch (NoSuchNamespaceException e) { namespaces = catalog.listNamespaces(); } Prevention
- 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.
When it happens
Trigger: Calling catalog.listNamespaces(Namespace.of("someDataset")) or any engine API that lists the children of a named namespace.
Common situations: Engine metadata browsing that tries to list sub-namespaces of a dataset; code ported from catalogs (e.g. JDBC/Hive) that support hierarchical namespaces.
Related errors
- Table rename operation is unsupported.
- Creating BigQuery client failed
- Creating BigQuery client failed due to a security issue
- %s
- Namespace already exists: %s
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/127a44a488ba63ba.
Report an issue: GitHub.