apache/iceberg · error · NoSuchTableException
NoSuchTableException(ident)
Error message
NoSuchTableException(ident)
What it means
SparkRewriteTableCatalog.loadTable resolves tables only from the in-memory SparkTableCache populated by a rewrite procedure; if the group id is absent from the cache it throws Spark's NoSuchTableException. The catalog intentionally cannot load arbitrary tables.
Solutions
- Run table access through a normal catalog; the rewrite catalog only works within procedure execution
- Ensure the identifier corresponds to an active rewrite group id created by the procedure
- Register the table in SparkTableCache with the same group id if writing framework code
Example fix
// before
val table = spark.sessionState.catalogManager.catalog("prod").asTableCatalog.loadTable(ident) // rewrite catalog
// after
val table = spark.table("prod.db.events") // use the normal Iceberg catalog binding Defensive patterns
Strategy: try-catch
Validate before calling
if (!spark.sessionState.catalogManager.isCatalogRegistered("prod")) ??? // prefer standard catalog for loads Try / catch
try {
catalog.loadTable(ident)
} catch {
case _: NoSuchTableException => loadViaSparkCatalog(ident)
} Prevention
- Do not resolve tables through the rewrite catalog outside procedure execution
- Ensure group ids match those created by the running rewrite procedure
- Configure user-facing catalog bindings to SparkCatalog
When it happens
Trigger: Calling loadTable(ident) where ident.name() is not a group id currently registered in SparkTableCache, e.g. loading a table by its real name outside an active rewrite procedure.
Common situations: Querying tables through a rewrite catalog binding outside the rewrite procedure's execution; using a stale group id after the procedure finished; misconfigured catalog binding.
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
- Cannot find source table
- Couldn't load table ' ' in catalog
- Couldn't load table ' ' in catalog
- NoSuchTableException(from)
- NoSuchTableException(ident)
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/7105802b84b52ee4.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java:55
private static final String CLASS_NAME = SparkRewriteTableCatalog.class.getName();
private static final SparkTableCache TABLE_CACHE = SparkTableCache.get();
private String name = null;
@Override
public Identifier[] listTables(String[] namespace) {
throw new UnsupportedOperationException(CLASS_NAME + " does not support listing tables");
}
@Override
public SparkRewriteTable loadTable(Identifier ident) throws NoSuchTableException {
validateNoNamespace(ident);
String groupId = ident.name();
Table table = TABLE_CACHE.get(groupId);
if (table == null) {
throw new NoSuchTableException(ident);
}
return new SparkRewriteTable(table, groupId);
}
@Override
public SparkTable loadTable(Identifier ident, String version) throws NoSuchTableException {
throw new UnsupportedOperationException(CLASS_NAME + " does not support time travel");
}
@Override
public SparkTable loadTable(Identifier ident, long timestampMicros) throws NoSuchTableException {
throw new UnsupportedOperationException(CLASS_NAME + " does not support time travel");
}
@Override
public void invalidateTable(Identifier ident) {
throw new UnsupportedOperationException(CLASS_NAME + " does not support table invalidation");View on GitHub (pinned to 86d9c8fc54)