apache/iceberg · error · UncheckedInterruptedException
Interrupted while getting table metadata for '%s'
Error message
Interrupted while getting table metadata for '%s'
What it means
JdbcSnowflakeClient.loadTableMetadata queries Snowflake for table metadata via JDBC. If the thread waiting on the JDBC call is interrupted, the InterruptedException is rethrown as an UncheckedInterruptedException so callers of the catalog API do not have to handle checked exceptions. This signals the calling thread's execution was cancelled mid-operation, typically during JVM or task shutdown.
Source
Thrown at snowflake/src/main/java/org/apache/iceberg/snowflake/JdbcSnowflakeClient.java:353
tableIdentifier);
SnowflakeTableMetadata tableMeta;
try {
final String finalQuery = "SELECT SYSTEM$GET_ICEBERG_TABLE_INFORMATION(?) AS METADATA";
tableMeta =
connectionPool.run(
conn ->
queryHarness.query(
conn,
finalQuery,
TABLE_METADATA_RESULT_SET_HANDLER,
tableIdentifier.toIdentifierString()));
} catch (SQLException e) {
throw snowflakeExceptionToIcebergException(
tableIdentifier,
e,
String.format("Failed to get table metadata for '%s'", tableIdentifier));
} catch (InterruptedException e) {
throw new UncheckedInterruptedException(
e, "Interrupted while getting table metadata for '%s'", tableIdentifier);
}
return tableMeta;
}
@Override
public void close() {
connectionPool.close();
}
private RuntimeException snowflakeExceptionToIcebergException(
SnowflakeIdentifier identifier, SQLException ex, String defaultExceptionMessage) {
// NoSuchNamespace exception for Database and Schema cases
if ((identifier.type() == SnowflakeIdentifier.Type.DATABASE
&& DATABASE_NOT_FOUND_ERROR_CODES.contains(ex.getErrorCode()))
|| (identifier.type() == SnowflakeIdentifier.Type.SCHEMA
&& SCHEMA_NOT_FOUND_ERROR_CODES.contains(ex.getErrorCode()))) {
return new NoSuchNamespaceException(View on GitHub (pinned to 86d9c8fc54)
Solutions
- Retain the interrupt status by calling Thread.currentThread().interrupt() in the wrapper or catch block before handling
- Retry the loadTable call on a fresh, non-interrupted thread if cancellation was incidental
- Move catalog initialization/metadata loading to a lifecycle phase that is not subject to interruption
- Check for and remove sources of premature interruption (over-aggressive timeouts, executors shut down too early)
Example fix
// before
TableMetadata meta = jdbcClient.loadTableMetadata(ident);
// after
try {
TableMetadata meta = jdbcClient.loadTableMetadata(ident);
} catch (UncheckedInterruptedException e) {
Thread.currentThread().interrupt();
throw e; // or retry if interruption was incidental
} Defensive patterns
Strategy: retry
Validate before calling
if (Thread.currentThread().isInterrupted()) {
// resolve interruption state before issuing the JDBC-backed lookup
}
TableMetadata meta = catalog.loadTable(ident); Try / catch
try {
TableMetadata meta = catalog.loadTable(ident);
} catch (UncheckedInterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("Table metadata load cancelled: " + ident, e);
} Prevention
- Do not call catalog load methods from threads during shutdown
- Use completion-based cancellation (futures without interrupt) when possible
- Load table metadata once and cache it instead of re-querying under time pressure
- Monitor interrupt status in long-running ETL frameworks
When it happens
Trigger: Calling loadTable/loadTableMetadata on a Snowflake table while the invoking thread's interrupt flag is set, e.g. during a Spark/Flink task cancellation, executor shutdown, or a future.cancel(true) while the JDBC query is in flight.
Common situations: Spark query cancellation kills running tasks and interrupts threads using the Snowflake catalog; application server shutdown interrupts in-flight catalog lookups; timeout frameworks interrupt worker threads that then call loadTable.
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
- Interrupted in call to initialize
- Interrupted in SQL command
- Interrupted in SQL query
- Failed to insert: %d of %d succeeded
- Failed to update: %d of %d succeeded
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/9f35fc9b907b05c1.
Report an issue: GitHub.