apache/iceberg · error · RuntimeException

Interrupted in call to rename

Error message

Interrupted in call to rename

What it means

Thrown when the thread is interrupted while waiting for the Hive Metastore rename call to complete. Iceberg restores the interrupt flag via Thread.currentThread().interrupt() and then throws this RuntimeException so the failure is not silently swallowed. The rename did not complete.

Solutions

  1. Determine who interrupted the thread (job cancellation vs timeout) and re-run the rename if the operation should still happen.
  2. Check metastore latency: a healthy metastore rarely makes the call slow enough to be interrupted by timeouts.
  3. Handle InterruptedException properly in your own wrapper code — restore the interrupt flag and decide whether to retry or abort.

Example fix

// before
catalog.renameTable(from, to);
// after
try {
  catalog.renameTable(from, to);
} catch (RuntimeException e) {
  if (Thread.currentThread().isInterrupted()) {
    throw new IllegalStateException("Rename cancelled by interruption", e);
  }
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (Thread.currentThread().isInterrupted()) { throw new IllegalStateException("Interrupted before rename"); }

Try / catch

try { catalog.renameTable(from, to); } catch (RuntimeException e) { if (Thread.currentThread().isInterrupted()) { /* cancellation path: abort cleanly */ } throw e; }

Prevention

When it happens

Trigger: renameTable/renameView while the calling thread's interrupt flag is set or is set during the blocking metastore call — typically task cancellation, executor shutdown, or query cancellation (e.g. Spark killing a stage).

Common situations: Cancelling a Spark/Flink job that performs catalog renames; shutting down a thread pool mid-migration; timeout-based frameworks interrupting slow metastore calls.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:453

          throw new NoSuchTableException("Cannot rename %s to %s. Table does not exist", from, to);
        case VIEW:
          throw new NoSuchViewException("Cannot rename %s to %s. View does not exist", from, to);
      }

    } catch (InvalidOperationException e) {
      if (e.getMessage() != null
          && e.getMessage().contains(String.format("new table %s already exists", to))) {
        throw new AlreadyExistsException("Table already exists: %s", to);
      } else {
        throw new RuntimeException("Failed to rename " + from + " to " + to, e);
      }

    } catch (TException e) {
      throw new RuntimeException("Failed to rename " + from + " to " + to, e);

    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException("Interrupted in call to rename", e);
    }
  }

  private void validateTableIsIcebergTableOrView(
      HiveOperationsBase.ContentType contentType, Table table, String fullName) {
    switch (contentType) {
      case TABLE:
        HiveOperationsBase.validateTableIsIceberg(table, fullName);
        break;
      case VIEW:
        HiveOperationsBase.validateTableIsIcebergView(table, fullName);
    }
  }

  /**
   * Check whether table or metadata table exists.
   *
   * <p>Note: If a hive table with the same identifier exists in catalog, this method will return

View on GitHub (pinned to 86d9c8fc54)