apache/iceberg · error · NoSuchNamespaceException
Cannot rename %s to %s because namespace %s does not exist
Error message
Cannot rename %s to %s because namespace %s does not exist
What it means
EcsCatalog.renameTable validates that the destination namespace exists before renaming and throws NoSuchNamespaceException when it does not. ECS stores tables as objects under namespace prefixes, so a rename to a non-existent namespace prefix would leave the table unreachable.
Source
Thrown at dell/src/main/java/org/apache/iceberg/dell/ecs/EcsCatalog.java:239
client.deleteObject(tableObjectURI.bucket(), tableObjectURI.name());
return true;
}
private EcsURI tableURI(TableIdentifier id) {
return new EcsURI(
String.format("%s/%s%s", namespacePrefix(id.namespace()), id.name(), TABLE_OBJECT_SUFFIX));
}
/**
* Table rename will only move table object, the data objects will still be in-place.
*
* @param from identifier of the table to rename
* @param to new table name
*/
@Override
public void renameTable(TableIdentifier from, TableIdentifier to) {
if (!namespaceExists(to.namespace())) {
throw new NoSuchNamespaceException(
"Cannot rename %s to %s because namespace %s does not exist", from, to, to.namespace());
}
if (tableExists(to)) {
throw new AlreadyExistsException(
"Cannot rename %s because destination table %s exists", from, to);
}
EcsURI fromURI = tableURI(from);
if (!objectMetadata(fromURI).isPresent()) {
throw new NoSuchTableException("Cannot rename table because table %s does not exist", from);
}
Properties properties = loadProperties(fromURI);
EcsURI toURI = tableURI(to);
if (!putNewProperties(toURI, properties.content())) {
throw new AlreadyExistsException(View on GitHub (pinned to 86d9c8fc54)
Solutions
- Call catalog.createNamespace(to.namespace()) before renameTable.
- Verify the destination namespace with catalog.namespaceExists(to.namespace()) and catch NoSuchNamespaceException otherwise.
- Fix the target namespace identifier if it was a typo.
Example fix
// before
catalog.renameTable(from, TableIdentifier.of(Namespace.of("archived"), "t"));
// after
Namespace ns = Namespace.of("archived");
if (!catalog.namespaceExists(ns)) { catalog.createNamespace(ns); }
catalog.renameTable(from, TableIdentifier.of(ns, "t")); Defensive patterns
Strategy: validation
Validate before calling
Namespace destNs = to.namespace();
if (!catalog.namespaceExists(destNs)) { catalog.createNamespace(destNs); } Try / catch
try {
catalog.renameTable(from, to);
} catch (NoSuchNamespaceException e) {
catalog.createNamespace(to.namespace());
catalog.renameTable(from, to);
} Prevention
- Create all target namespaces before table reorganizations
- Validate namespace spelling in scripts
- Serialize reorganization jobs that share namespaces
When it happens
Trigger: Calling catalog.renameTable(from, to) where to.namespace() has no namespace marker object in ECS — e.g. renaming into a namespace that was never created or was dropped.
Common situations: Renaming tables during a reorganization into new namespaces without creating them first; typos in the target namespace; concurrent drop of the destination namespace.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Namespace %s does not exist
- Cannot rename %s because destination table %s exists
- Cannot rename table because table %s does not exist
- namespace %s(%s) has already existed
- Namespace %s(%s) properties object is absent
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/1800c4265e5a0d16.
Report an issue: GitHub.