apache/iceberg · error · NoSuchViewException

View does not exist: %s

Error message

View does not exist: %s

What it means

Thrown by NessieIcebergClient.validateFromContentForRename when renaming an Iceberg view via the Nessie catalog but the source content cannot be fetched in Nessie (existingFromContent == null). The view simply does not exist under the requested reference. It surfaces as NoSuchViewException from a renameTable/renameView operation.

Source

Thrown at nessie/src/main/java/org/apache/iceberg/nessie/NessieIcebergClient.java:534

      TableIdentifier from, TableIdentifier to, IcebergContent existingToContent) {
    if (existingToContent != null) {
      if (existingToContent.getType() == Content.Type.ICEBERG_VIEW) {
        throw new AlreadyExistsException("Cannot rename %s to %s. View already exists", from, to);
      } else if (existingToContent.getType() == Content.Type.ICEBERG_TABLE) {
        throw new AlreadyExistsException("Cannot rename %s to %s. Table already exists", from, to);
      } else {
        throw new AlreadyExistsException(
            "Cannot rename %s to %s. Another content of type %s with same name already exists",
            from, to, existingToContent.getType());
      }
    }
  }

  private static void validateFromContentForRename(
      TableIdentifier from, Content.Type type, IcebergContent existingFromContent) {
    if (existingFromContent == null) {
      if (type == Content.Type.ICEBERG_VIEW) {
        throw new NoSuchViewException("View does not exist: %s", from);
      } else if (type == Content.Type.ICEBERG_TABLE) {
        throw new NoSuchTableException("Table does not exist: %s", from);
      } else {
        throw new RuntimeException("Cannot perform rename for content type: " + type);
      }
    } else if (existingFromContent.getType() != type) {
      throw new RuntimeException(
          String.format("content type of from identifier %s should be of %s", from, type));
    }
  }

  public boolean dropTable(TableIdentifier identifier, boolean purge) {
    return dropContent(identifier, purge, Content.Type.ICEBERG_TABLE);
  }

  public boolean dropView(TableIdentifier identifier, boolean purge) {
    return dropContent(identifier, purge, Content.Type.ICEBERG_VIEW);
  }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. List contents on the current ref (catalog.listViews / listTables) to confirm the view exists before renaming.
  2. Verify the Nessie ref (branch/tag) the client uses matches the branch where the view exists; use NessieCatalog.setRef or pass the right ref in catalog properties.
  3. Fix the identifier spelling including namespace.
  4. Handle NoSuchViewException in the caller and create the view first if that is intended.

Example fix

// before
catalog.renameTable(TableIdentifier.of("ns", "my_veiw"), TableIdentifier.of("ns", "my_view"));
// after
TableIdentifier from = TableIdentifier.of("ns", "my_view");
if (!catalog.viewExists(from)) {
  throw new IllegalStateException("View not found on current ref: " + from);
}
catalog.renameView(from, TableIdentifier.of("ns", "my_view2"));
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.viewExists(from)) { throw new IllegalStateException("View not found: " + from); }

Try / catch

try { catalog.renameView(from, to); } catch (NoSuchViewException e) { log.warn("View missing on current ref: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling catalog.renameTable(from, to) or renameView where the from identifier points to a view path that does not exist on the current Nessie ref, e.g. wrong branch/tag, typo in identifier, or the view was already dropped.

Common situations: Developer renames a view while the Nessie client is pinned to a branch that doesn't contain it; concurrent job dropped the view before rename; namespace or view name misspelled in the Spark/Flink SQL statement.

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


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