apache/iceberg · error · NoSuchTableException

Cannot rename table because table %s does not exist

Error message

Cannot rename table because table %s does not exist

What it means

Guard in EcsCatalog.renameTable: after verifying the destination namespace exists and the destination table does not, the source table's ECS object metadata was not found — the table being renamed does not exist. The %s is the source TableIdentifier; the rename aborts before any ECS mutation.

Source

Thrown at dell/src/main/java/org/apache/iceberg/dell/ecs/EcsCatalog.java:250

   *
   * @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(
          "Cannot rename %s because destination table %s exists", from, to);
    }

    client.deleteObject(fromURI.bucket(), fromURI.name());
    LOG.info("Rename table {} to {}", from, to);
  }

  @Override
  public void createNamespace(Namespace namespace, Map<String, String> properties) {
    EcsURI namespaceObject = namespaceURI(namespace);
    if (!putNewProperties(namespaceObject, properties)) {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify the source table exists with catalog.tableExists(from) before renaming.
  2. Correct the source table identifier (case-sensitive namespace/table levels).
  3. Re-create the table if it was deleted unintentionally.

Example fix

// before
catalog.renameTable(from, to);
// after
if (!catalog.tableExists(from)) {
  throw new IllegalStateException("Source table missing: " + from);
}
catalog.renameTable(from, to);
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.tableExists(from)) { throw new IllegalStateException("Source missing: " + from); }

Try / catch

try {
  catalog.renameTable(from, to);
} catch (NoSuchTableException e) {
  LOG.error("Source table {} no longer exists", from, e);
}

Prevention

When it happens

Trigger: Calling catalog.renameTable(from, to) where objectMetadata(tableURI(from)) returns empty — the source table was dropped, never created, or the identifier doesn't match the stored prefix.

Common situations: Renaming a table after it was dropped by another process; stale catalog caches pointing to removed objects; case/spelling mismatch in the source identifier.

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


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/f435d072b6d1ccf3. Report an issue: GitHub.