{"record":{"id":"dae5e1efd0d5047c","repo":"apache/iceberg","slug":"namespace-does-not-exist-s-dae5e1","errorCode":null,"errorMessage":"Namespace does not exist: %s","messagePattern":"Namespace does not exist: (.+?)","errorType":"exception","errorClass":"NoSuchNamespaceException","httpStatus":404,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java","lineNumber":345,"sourceCode":"    return ListNamespacesResponse.builder()\n        .addAll(page.first())\n        .nextPageToken(page.second())\n        .build();\n  }\n\n  public static CreateNamespaceResponse createNamespace(\n      SupportsNamespaces catalog, CreateNamespaceRequest request) {\n    Namespace namespace = request.namespace();\n    catalog.createNamespace(namespace, request.properties());\n    return CreateNamespaceResponse.builder()\n        .withNamespace(namespace)\n        .setProperties(catalog.loadNamespaceMetadata(namespace))\n        .build();\n  }\n\n  public static void namespaceExists(SupportsNamespaces catalog, Namespace namespace) {\n    if (!catalog.namespaceExists(namespace)) {\n      throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n    }\n  }\n\n  public static GetNamespaceResponse loadNamespace(\n      SupportsNamespaces catalog, Namespace namespace) {\n    Map<String, String> properties = catalog.loadNamespaceMetadata(namespace);\n    return GetNamespaceResponse.builder()\n        .withNamespace(namespace)\n        .setProperties(properties)\n        .build();\n  }\n\n  public static void dropNamespace(SupportsNamespaces catalog, Namespace namespace) {\n    boolean dropped = catalog.dropNamespace(namespace);\n    if (!dropped) {\n      throw new NoSuchNamespaceException(\"Namespace does not exist: %s\", namespace);\n    }\n  }","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java#L327-L363","documentation":"CatalogHandlers.namespaceExists translates a false catalog.namespaceExists result into a REST NoSuchNamespaceException. It is the standard mapping between the Iceberg catalog interface and REST error responses; receiving it means the namespace was not found in the backing catalog.","triggerScenarios":"Calling the REST namespace-existence path for a namespace the underlying SupportsNamespaces catalog does not contain.","commonSituations":"Typos in namespace names; referencing a namespace after it was dropped; environment mismatches (dev vs prod catalog); wrong catalog routing.","solutions":["Verify the namespace identifier and its levels","List existing namespaces (listNamespaces) to confirm the target exists","Create the namespace (createNamespace) before operating on it","Confirm you are pointed at the intended catalog/backend"],"exampleFix":"// before\nexists = client.get(\"v1/namespaces/\" + ns, ...); // 404 if missing\n// after\nListNamespacesResponse all = client.get(\"v1/namespaces\", ListNamespacesResponse.class);\nif (!all.namespaces().contains(ns)) {\n  client.post(\"v1/namespaces\", CreateNamespaceRequest.of(ns));\n}","handlingStrategy":"try-catch","validationCode":"List<Namespace> existing = catalog.listNamespaces(parent);\nif (!existing.contains(target)) {\n  // create or correct the namespace first\n}","typeGuard":null,"tryCatchPattern":"try {\n  handler.namespaceExists(catalog, ns);\n} catch (NoSuchNamespaceException e) {\n  catalog.createNamespace(ns);\n}","preventionTips":["Provision namespaces as part of environment setup","Standardize namespace naming to avoid typos","Verify catalog URI/config when environments differ"],"tags":["rest-catalog","namespace","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}