You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Iceberg REST catalog: metadata tables (.snapshots, .files, .history) fail with "Schema not found" #1983
Querying an Iceberg metadata table through the Iceberg REST catalog fails. From Spark:
SELECT snapshot_id, operation FROMuc.bronze.orders.snapshots;
-- org.apache.iceberg.exceptions.NoSuchNamespaceException: Schema not found: iceberg.bronze.orders
The same happens for .files, .history, .manifests and the rest. The base table loads fine.
Iceberg's REST client resolves a metadata table by retrying a failed loadTable: it first asks for namespace bronze<0x1F>orders, table snapshots, and when that comes back as NoSuchTableException it loads bronze.orders and returns its snapshots table (RESTSessionCatalog.loadTable). Unity Catalog answers the first request with NoSuchNamespaceException, because the schema lookup fails before the table lookup, so the client never retries. The REST spec answers loadTable (and the other routes addressed to one table) with NoSuchTableException.
With authorization on, the request fails the same way, earlier: resolving the request's securables looks the table up before the handler runs.
To Reproduce
Unity Catalog v0.7.0, a catalog with a storage root, and an Iceberg table created through the REST catalog (CREATE TABLE uc.bronze.orders ... USING iceberg, one INSERT).
Spark 4.1.0 with iceberg-spark-runtime-4.1_2.13:1.12.0, catalog uc of type=rest pointed at /api/2.1/unity-catalog/iceberg.
SELECT * FROM uc.bronze.orders.snapshots.
Or directly:
curl -s "http://localhost:8080/api/2.1/unity-catalog/iceberg/v1/catalogs/uc/namespaces/bronze%1Forders/tables/snapshots"# {"error":{"message":"Schema not found: uc.bronze.orders","type":"NoSuchNamespaceException","code":404}}
Expected behavior
404 with type NoSuchTableException, so the client loads bronze.orders and returns its snapshots table. Namespace routes (and listing/creating tables in a namespace) should keep answering NoSuchNamespaceException for a missing namespace.
System
Unity Catalog v0.7.0 (built from the tag; also on main at 45c6397)
Spark 4.1.0, Iceberg 1.12.0, Linux
Additional context
The same answer makes the Iceberg client's dropTable on a missing namespace throw instead of returning false. A fix with tests is ready (PR to follow).
UC 0.7.0: Spark can't read Iceberg metadata tables (t.snapshots) through the Iceberg REST catalog
Triage write-up, Oct 13, 2026. Found while building the UC 0.7 native Iceberg notebooks in open-lakehouse/unitycatalog-playground.
Summary
From Spark, SELECT * FROM unity.iceberg_spark.adoptions.snapshots fails against Unity Catalog 0.7.0 with:
org.apache.iceberg.exceptions.NoSuchNamespaceException: Schema not found: unity.iceberg_spark.adoptions
Iceberg's Java REST client resolves <table>.snapshots by first asking the catalog for a table named snapshots in a namespace called iceberg_spark.adoptions. It falls back to the metadata table only when the server answers NoSuchTableException. For a namespace that doesn't exist, UC's loadTable answers NoSuchNamespaceException instead, so the fallback never runs.
The Iceberg REST spec lists NoSuchTableException as the only 404 for loadTable, and Iceberg's reference server deliberately returns it for exactly this case. UC is the one off-spec here. The fix is likely small and server-side.
This affects more than metadata tables: branch and snapshot selectors in a table name, and the changelog procedure, fail the same way.
Environment
Component
Version
Unity Catalog server
newfrontdocker/unitycatalog:v0.7.0 (sha256:cdacdc5e7624795e7b2a18ece0d7357c5a1ec640db17fccb4d0fb208dd0d335b, built 2026-10-13), unitycatalog-server-0.7.0.jar
Metadata tables: only snapshots was tested through the catalog. All the others (history, files, manifests, partitions, refs, entries, all_*, ...) go through the same lookup, so they should fail the same way.
Branch writes: writing to a branch by name (INSERT INTO t.branch_<name>) uses the same lookup and is likely affected too, but wasn't tested.
PyIceberg: works because it loads the base table by its real name and builds metadata tables on the client, so the ambiguous lookup never reaches the server.
Other engines: Flink, Trino and others weren't tested. Any engine that uses Iceberg Java's RESTSessionCatalog gets the same fallback logic.
Reproduce
Using the playground: run just uc=local start, then run the Spark Iceberg notebook once to create unity.iceberg_spark.adoptions. Any Iceberg table in UC works the same way.
1. The HTTP request the Iceberg client makes. Iceberg REST paths separate nested namespace levels with %1F.
# Control: the table exists
curl -s -o /dev/null -w "%{http_code}\n" \
"http://localhost:8080/api/2.1/unity-catalog/iceberg/v1/catalogs/unity/namespaces/iceberg_spark/tables/adoptions"# 200# What Spark sends for unity.iceberg_spark.adoptions.snapshots
curl -s "http://localhost:8080/api/2.1/unity-catalog/iceberg/v1/catalogs/unity/namespaces/iceberg_spark%1Fadoptions/tables/snapshots"# {"error":{"message":"Schema not found: unity.iceberg_spark.adoptions","type":"NoSuchNamespaceException","code":404}}
Expected: a 404 with "type":"NoSuchTableException". Keeping the message text is fine.
2. From Spark (Spark session with unity set up as an Iceberg REST SparkCatalog pointed at UC):
spark.sql("SELECT * FROM unity.iceberg_spark.adoptions.snapshots").show()
# org.apache.iceberg.exceptions.NoSuchNamespaceException: Schema not found: unity.iceberg_spark.adoptions
Root cause
Client side: Iceberg only falls back on NoSuchTableException
A name like ns.table.snapshots is ambiguous: it could be a table named snapshots in nested namespace ns.table. Iceberg's REST client tries that first, and treats the last part as a metadata table only if the server says "no such table" (RESTSessionCatalog.java#L484):
} catch (NoSuchTableExceptionoriginal) {
metadataType = MetadataTableType.from(identifier.name());
if (metadataType != null) {
// attempt to load a metadata table using the identifier's namespace as the base tableTableIdentifierbaseIdent = TableIdentifier.of(identifier.namespace().levels());
The client picks the exception from the error type in the response. A 404 typed NoSuchNamespaceException becomes a NoSuchNamespaceException, which isn't caught above (ErrorHandlers.java#L142-L162).
Spark's SparkCatalog has a second fallback with the same check, for snapshot/branch selectors and the changelog table (SparkCatalog.java#L808-L821). That's why t.branch_main, t.snapshot_id_<id> and create_changelog_view break too.
Spec and reference implementation: loadTable should answer NoSuchTableException
The REST spec gives loadTable exactly one 404: "Not Found - NoSuchTableException, table to load does not exist" (rest-catalog-open-api.yaml#L1011).
} elseif (tableinstanceofBaseMetadataTable) {
// metadata tables are loaded on the client side, return NoSuchTableException for nowthrownewNoSuchTableException("Table does not exist: %s", ident.toString());
}
Server side: UC reports the missing schema as NoSuchNamespaceException
The UC server source ships in the image under /home/unitycatalog/server/src/main/java/io/unitycatalog/server/. Paths below are relative to that directory.
loadTable looks up the table.service/IcebergRestCatalogService.java:362-376 (and tableExists, :345-360) calls tableRepository.getIcebergTableState(catalog, namespace, table).
The lookup fails on the schema first. That calls findTableOrThrow (persist/TableRepository.java:705-716), which resolves the schema before the table. For namespace iceberg_spark.adoptions it throws BaseException(SCHEMA_NOT_FOUND, "Schema not found: unity.iceberg_spark.adoptions").
The handler maps that to NoSuchNamespaceException.exception/IcebergRestExceptionHandler.java:80-82 turns the error code into an Iceberg error type:
This mapping is intentional. The Javadoc on errorType (:48-65) explains that a missing catalog or schema should show up at the client as a missing namespace, not a missing table. That's right for namespace-level endpoints, where the spec allows NoSuchNamespaceException. It's wrong for loadTable, where the spec doesn't, and where Iceberg clients rely on NoSuchTableException to resolve metadata tables and selectors.
Proposed fix
On loadTable (and tableExists), report a missing schema as NoSuchTableException. Keep the message so users still see "Schema not found". Leave the namespace endpoints (listTables, getNamespace, createTable, ...) as they are.
An illustrative sketch for IcebergRestCatalogService.loadTable / tableExists:
TableRepository.IcebergTableStatestate;
try {
state = tableRepository.getIcebergTableState(catalog, namespace, table);
} catch (BaseExceptione) {
if (e.getErrorCode() == ErrorCode.SCHEMA_NOT_FOUND) {
// The REST spec answers loadTable with NoSuchTableException only. Iceberg clients rely on it// to resolve metadata tables (ns.table.snapshots) and Spark selectors (ns.table.branch_x).thrownewNoSuchTableException("%s", e.getErrorMessage());
}
throwe;
}
The handler already maps an org.apache.iceberg.exceptions.NoSuchTableException to a 404 typed NoSuchTableException; that's what loadTable returns today for a missing table in an existing schema.
Suggested regression tests:
GET .../namespaces/<existing_schema>%1F<existing_table>/tables/snapshots returns 404 with type=NoSuchTableException.
From Spark against UC: SELECT * FROM t.snapshots, SELECT * FROM t.branch_main and CALL system.create_changelog_view(...) all succeed.
Open questions for the team
Auth-enabled servers. With server.authorization=enable, the authorization layer resolves catalog.schema.table to IDs before the handler runs (auth/decorator/KeyMapper.java:147-156, via tableRepository.getTable). That path probably raises the same not-found error before loadTable's body runs, in which case a handler-only fix wouldn't cover it. Not tested: the playground runs with auth disabled.
Is NoSuchNamespaceException from loadTable relied on anywhere? For example, UC tests or UC's own clients. If so, this change would need to update them.
Same treatment for other table endpoints? The credentials endpoint (:411) and metrics endpoint (:867) use the same lookup. They aren't involved in metadata-table resolution, but consistency may be worth it.
Existing upstream issue? I haven't checked whether there's already an issue or PR for this.
Workarounds in use today
Lineage and time travel: the playground's Spark notebook uses CALL unity.system.ancestors_of(...), VERSION AS OF <snapshot_id>, and the _file / _partition / _spec_id metadata columns.
Metadata tables: the PyIceberg notebook uses table.inspect.*.
ancestors_of doesn't replace snapshots. It only walks the current lineage, so after a CREATE OR REPLACE TABLE it returns 6 rows where snapshots returns 18.
Spark-only escape hatch (not recommended). Loading by file path bypasses the catalog and works:
It needs hadoop-aws, s3:// mapped to S3A, and the table's metadata-location plus vended S3 credentials taken from UC's REST loadTable response. Spark doesn't expose either. The result is a fixed point-in-time view, and the credentials don't refresh. It works as a diagnostic: the metadata is fine, and only the name lookup is broken.
When this is fixed upstream, remove the corresponding row in the playground's AGENTS.md ("Upstream 0.7.0 issues") and the note in notebooks/iceberg/unitycatalog-iceberg-spark.py, and add a Spark t.snapshots cell.
Activity
newfront commentedon Oct 14, 2026
Thanks @lisancao.
newfront commentedon Oct 14, 2026
Additional Notes for this one.
UC 0.7.0: Spark can't read Iceberg metadata tables (
t.snapshots) through the Iceberg REST catalogTriage write-up, Oct 13, 2026. Found while building the UC 0.7 native Iceberg notebooks in
open-lakehouse/unitycatalog-playground.Summary
From Spark,
SELECT * FROM unity.iceberg_spark.adoptions.snapshotsfails against Unity Catalog 0.7.0 with:Iceberg's Java REST client resolves
<table>.snapshotsby first asking the catalog for a table namedsnapshotsin a namespace callediceberg_spark.adoptions. It falls back to the metadata table only when the server answersNoSuchTableException. For a namespace that doesn't exist, UC'sloadTableanswersNoSuchNamespaceExceptioninstead, so the fallback never runs.The Iceberg REST spec lists
NoSuchTableExceptionas the only 404 forloadTable, and Iceberg's reference server deliberately returns it for exactly this case. UC is the one off-spec here. The fix is likely small and server-side.This affects more than metadata tables: branch and snapshot selectors in a table name, and the changelog procedure, fail the same way.
Environment
newfrontdocker/unitycatalog:v0.7.0(sha256:cdacdc5e7624795e7b2a18ece0d7357c5a1ec640db17fccb4d0fb208dd0d335b, built 2026-10-13),unitycatalog-server-0.7.0.jariceberg-spark-runtime-4.1_2.13:1.11.0server.authorization=disable, Postgres metadata store, RustFS (S3-compatible) storageThe same behavior was seen on the earlier
v0.7.0-SNAPSHOTimage.Impact
Tested from Spark against a managed Iceberg table (
unity.iceberg_spark.adoptions):SELECT * FROM t.snapshotsspark.table("...adoptions.snapshots"),spark.read.format("iceberg").load("...adoptions.snapshots")SELECT * FROM t.snapshot_id_<id>SELECT * FROM t.branch_mainCALL unity.system.create_changelog_view(table => ...)SELECT ... VERSION AS OF <id>CALL unity.system.ancestors_of(...)_file,_partition,_spec_idtable.inspect.snapshots(),.files(),.history(), ...snapshotswas tested through the catalog. All the others (history,files,manifests,partitions,refs,entries,all_*, ...) go through the same lookup, so they should fail the same way.INSERT INTO t.branch_<name>) uses the same lookup and is likely affected too, but wasn't tested.RESTSessionCataloggets the same fallback logic.Reproduce
Using the playground: run
just uc=local start, then run the Spark Iceberg notebook once to createunity.iceberg_spark.adoptions. Any Iceberg table in UC works the same way.1. The HTTP request the Iceberg client makes. Iceberg REST paths separate nested namespace levels with
%1F.Expected: a 404 with
"type":"NoSuchTableException". Keeping the message text is fine.2. From Spark (Spark session with
unityset up as an Iceberg RESTSparkCatalogpointed at UC):Root cause
Client side: Iceberg only falls back on
NoSuchTableExceptionA name like
ns.table.snapshotsis ambiguous: it could be a table namedsnapshotsin nested namespacens.table. Iceberg's REST client tries that first, and treats the last part as a metadata table only if the server says "no such table" (RESTSessionCatalog.java#L484):The client picks the exception from the error
typein the response. A 404 typedNoSuchNamespaceExceptionbecomes aNoSuchNamespaceException, which isn't caught above (ErrorHandlers.java#L142-L162).Spark's
SparkCataloghas a second fallback with the same check, for snapshot/branch selectors and the changelog table (SparkCatalog.java#L808-L821). That's whyt.branch_main,t.snapshot_id_<id>andcreate_changelog_viewbreak too.Spec and reference implementation:
loadTableshould answerNoSuchTableExceptionThe REST spec gives
loadTableexactly one 404: "Not Found - NoSuchTableException, table to load does not exist" (rest-catalog-open-api.yaml#L1011).Iceberg's reference server handles this case explicitly (
CatalogHandlers.java#L538-L541):Server side: UC reports the missing schema as
NoSuchNamespaceExceptionThe UC server source ships in the image under
/home/unitycatalog/server/src/main/java/io/unitycatalog/server/. Paths below are relative to that directory.loadTablelooks up the table.service/IcebergRestCatalogService.java:362-376(andtableExists,:345-360) callstableRepository.getIcebergTableState(catalog, namespace, table).The lookup fails on the schema first. That calls
findTableOrThrow(persist/TableRepository.java:705-716), which resolves the schema before the table. For namespaceiceberg_spark.adoptionsit throwsBaseException(SCHEMA_NOT_FOUND, "Schema not found: unity.iceberg_spark.adoptions").The handler maps that to
NoSuchNamespaceException.exception/IcebergRestExceptionHandler.java:80-82turns the error code into an Iceberg error type:This mapping is intentional. The Javadoc on
errorType(:48-65) explains that a missing catalog or schema should show up at the client as a missing namespace, not a missing table. That's right for namespace-level endpoints, where the spec allowsNoSuchNamespaceException. It's wrong forloadTable, where the spec doesn't, and where Iceberg clients rely onNoSuchTableExceptionto resolve metadata tables and selectors.Proposed fix
On
loadTable(andtableExists), report a missing schema asNoSuchTableException. Keep the message so users still see "Schema not found". Leave the namespace endpoints (listTables,getNamespace,createTable, ...) as they are.An illustrative sketch for
IcebergRestCatalogService.loadTable/tableExists:The handler already maps an
org.apache.iceberg.exceptions.NoSuchTableExceptionto a 404 typedNoSuchTableException; that's whatloadTablereturns today for a missing table in an existing schema.Suggested regression tests:
GET .../namespaces/<existing_schema>%1F<existing_table>/tables/snapshotsreturns 404 withtype=NoSuchTableException.SELECT * FROM t.snapshots,SELECT * FROM t.branch_mainandCALL system.create_changelog_view(...)all succeed.Open questions for the team
server.authorization=enable, the authorization layer resolvescatalog.schema.tableto IDs before the handler runs (auth/decorator/KeyMapper.java:147-156, viatableRepository.getTable). That path probably raises the same not-found error beforeloadTable's body runs, in which case a handler-only fix wouldn't cover it. Not tested: the playground runs with auth disabled.NoSuchNamespaceExceptionfromloadTablerelied on anywhere? For example, UC tests or UC's own clients. If so, this change would need to update them.:411) and metrics endpoint (:867) use the same lookup. They aren't involved in metadata-table resolution, but consistency may be worth it.Workarounds in use today
CALL unity.system.ancestors_of(...),VERSION AS OF <snapshot_id>, and the_file/_partition/_spec_idmetadata columns.table.inspect.*.ancestors_ofdoesn't replacesnapshots. It only walks the current lineage, so after aCREATE OR REPLACE TABLEit returns 6 rows wheresnapshotsreturns 18.Spark-only escape hatch (not recommended). Loading by file path bypasses the catalog and works:
It needs
hadoop-aws,s3://mapped to S3A, and the table'smetadata-locationplus vended S3 credentials taken from UC's RESTloadTableresponse. Spark doesn't expose either. The result is a fixed point-in-time view, and the credentials don't refresh. It works as a diagnostic: the metadata is fine, and only the name lookup is broken.When this is fixed upstream, remove the corresponding row in the playground's
AGENTS.md("Upstream 0.7.0 issues") and the note innotebooks/iceberg/unitycatalog-iceberg-spark.py, and add a Sparkt.snapshotscell.[Server] Report a missing namespace as a missing table on table route…