Thanks for pointing this out Pascha and I can try and add some historical context to this.
I believe the reason why this is currently done this way in the *OpenAPI* spec and in the *ErrorHandler* is because this is the behavior that has been defined in the Catalog <https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/catalog/Catalog.java#L324> and ViewCatalog <https://github.com/apache/iceberg/blob/main/api/src/main/java/org/apache/iceberg/catalog/ViewCatalog.java#L53> APIs. Catalog implementations adhere to this behavior and we verify it in the CatalogTests <https://github.com/apache/iceberg/blob/main/core/src/test/java/org/apache/iceberg/catalog/CatalogTests.java#L921-L927> / ViewCatalogTests <https://github.com/apache/iceberg/blob/main/core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java#L82-L88> . Changing this now would require updating the definitions in the *Catalog* / *ViewCatalog* APIs and in the *OpenAPI* spec. Additionally, it would take some time for existing catalog implementations to adhere to the new expectations, so I think this makes it a bit more difficult with little benefit. I'm curious whether others think it would be worth updating this but so far I think we should just stick to the existing behavior. Thanks Eduard On Fri, Apr 4, 2025 at 11:24 AM Паша Варченко <varp...@gmail.com> wrote: > Hello! > Apache Iceberg REST Catalog API specification has many handlers that > contain namespace name in the request path or request body. > Some of such handlers regarding this specification can return > NoSuchNamespaceException (with 404 http code) > > https://github.com/apache/iceberg/blob/1.8.x/open-api/rest-catalog-open-api.yaml > > Examples: > GET /v1/{prefix}/namespaces/{namespace} > GET /v1/{prefix}/namespaces/{namespace}/views > etc > > And some of them just return NoSuchTableException/NoSuchViewException even > in case a namespace does not really exist. Examples: > GET, POST, DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table} > GET, POST, DELETE /v1/{prefix}/namespaces/{namespace}/views/{view} > GET /v1/{prefix}/namespaces/{namespace}/tables/{table}/credentials > POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/metrics > > We've found this situation during implementation of our own Iceberg REST > Catalog > https://github.com/apache/iceberg/issues/12466 > because first of all we check the existence of a namespace and then go > deeper to the hierarchy. > > Is there any reason why some handlers don't return > NoSuchNamespaceException and can we add it to the specification? >