apache/iceberg · error · NoSuchNamespaceException
Cannot create view %s in catalog %s. Namespace %s does not e
Error message
Cannot create view %s in catalog %s. Namespace %s does not exist
What it means
When creating a new view, if strict mode is enabled (jdbc.strict-mode=true in catalog properties) and the target namespace does not exist in the JDBC catalog, createView throws NoSuchNamespaceException instead of creating the view under an implicitly-existing namespace row.
Source
Thrown at core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java:177
private void updateView(String newMetadataLocation, String oldMetadataLocation)
throws SQLException, InterruptedException {
int updatedRecords =
JdbcUtil.updateView(
connections, catalogName, viewIdentifier, newMetadataLocation, oldMetadataLocation);
if (updatedRecords == 1) {
LOG.debug("Successfully committed to existing view: {}", viewIdentifier);
} else {
throw new CommitFailedException(
"Failed to update view %s from catalog %s", viewIdentifier, catalogName);
}
}
private void createView(String newMetadataLocation) throws SQLException, InterruptedException {
Namespace namespace = viewIdentifier.namespace();
if (PropertyUtil.propertyAsBoolean(catalogProperties, JdbcUtil.STRICT_MODE_PROPERTY, false)
&& !JdbcUtil.namespaceExists(catalogName, connections, namespace)) {
throw new NoSuchNamespaceException(
"Cannot create view %s in catalog %s. Namespace %s does not exist",
viewIdentifier, catalogName, namespace);
}
if (JdbcUtil.tableExists(JdbcUtil.SchemaVersion.V1, catalogName, connections, viewIdentifier)) {
throw new AlreadyExistsException("Table with same name already exists: %s", viewIdentifier);
}
if (JdbcUtil.viewExists(catalogName, connections, viewIdentifier)) {
throw new AlreadyExistsException("View already exists: %s", viewIdentifier);
}
int insertRecord =
JdbcUtil.doCommitCreateView(
connections, catalogName, namespace, viewIdentifier, newMetadataLocation);
if (insertRecord == 1) {
LOG.debug("Successfully committed to new view: {}", viewIdentifier);View on GitHub (pinned to 86d9c8fc54)
Solutions
- Create the namespace first: catalog.createNamespace(namespace) (or catalog.buildCreateNamespace(...)) before creating the view
- Disable strict mode by setting jdbc.strict-mode=false in the JDBC catalog properties if implicit namespace handling is acceptable
- Verify the namespace spelling in the view identifier matches an existing namespace
- Check namespace existence before commit: catalog.namespaceExists(namespace)
Example fix
// before
createView("my_ns.my_view"); // strict mode, namespace missing
// after
if (!catalog.namespaceExists(Namespace.of("my_ns"))) {
catalog.createNamespace(Namespace.of("my_ns"));
}
createView("my_ns.my_view"); Defensive patterns
Strategy: validation
Validate before calling
if (!catalog.namespaceExists(namespace)) {
catalog.createNamespace(namespace);
} Try / catch
try {
catalog.buildView(id)...create();
} catch (NoSuchNamespaceException e) {
catalog.createNamespace(id.namespace());
catalog.buildView(id)...create();
} Prevention
- Create namespaces as part of environment setup before creating views
- Check jdbc.strict-mode setting in catalog properties and align workflows with it
- Validate namespace spelling before commits
When it happens
Trigger: Committing a brand-new view (base == null) with catalog property jdbc.strict-mode=true while the parent namespace has never been created via createNamespace.
Common situations: Enabling strict mode on an existing catalog whose namespaces were created under non-strict behavior; writing views through a fresh JDBC catalog without initializing namespaces; a typo in the namespace name.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Cannot create table %s in catalog %s. Namespace %s does not
- Namespace does not exist: %s
- Table with same name already exists: %s
- Failed to create view %s in catalog %s
- Cannot create namespace %s because it already exists in Glue
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/35986d177da2399f.
Report an issue: GitHub.