apache/iceberg · error · NoSuchViewException

View does not exist: %s

Error message

View does not exist: %s

What it means

JdbcCatalog.renameView issues an UPDATE for the source view; if zero rows are affected the source view did not exist, so the catalog throws NoSuchViewException. This is the catalog's way of reporting that the rename's `from` identifier is absent from the view table.

Source

Thrown at core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java:749

    int updatedRecords =
        execute(
            err -> {
              if (JdbcUtil.isConstraintViolation(err)) {
                throw new AlreadyExistsException(
                    "Cannot rename %s to %s. View already exists", from, to);
              }
            },
            JdbcUtil.RENAME_VIEW_SQL,
            JdbcUtil.namespaceToString(to.namespace()),
            to.name(),
            catalogName,
            JdbcUtil.namespaceToString(from.namespace()),
            from.name());

    if (updatedRecords == 1) {
      LOG.info("Renamed view from {}, to {}", from, to);
    } else if (updatedRecords == 0) {
      throw new NoSuchViewException("View does not exist: %s", from);
    } else {
      LOG.warn(
          "Rename operation affected {} rows: the catalog view's primary key assumption has been violated",
          updatedRecords);
    }
  }

  @VisibleForTesting
  JdbcClientPool connectionPool() {
    return connections;
  }

  private int execute(String sql, String... args) {
    return execute(err -> {}, sql, args);
  }

  private int execute(Consumer<SQLException> sqlErrorHandler, String sql, String... args) {
    try {

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Verify the view exists with catalog.viewExists(from) before renaming
  2. Check the view name and namespace for typos and case
  3. Confirm you are connected to the correct JDBC catalog database
  4. Handle NoSuchViewException if the view may legitimately be missing

Example fix

// before
catalog.renameView(from, to);
// after
if (catalog.viewExists(from)) {
  catalog.renameView(from, to);
}
Defensive patterns

Strategy: validation

Validate before calling

if (!catalog.viewExists(from)) {
  throw new IllegalStateException("Source view missing: " + from);
}
catalog.renameView(from, to);

Try / catch

try {
  catalog.renameView(from, to);
} catch (NoSuchViewException e) {
  LOG.warn("View missing, skipping rename: {}", from);
}

Prevention

When it happens

Trigger: Calling catalog.renameView(from, to) when `from` was never created as a view, was already deleted, or exists as a table but not a view; also when the caller targets the wrong catalog/database.

Common situations: Typos in the view name or namespace; view deleted by another process between existence check and rename; pointing the catalog at the wrong JDBC database or table prefix.

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/ef329978a9c27061. Report an issue: GitHub.