{"record":{"id":"a70bfa8e1388e8c6","repo":"apache/iceberg","slug":"cannot-drop-namespace-s-s","errorCode":null,"errorMessage":"Cannot drop namespace '%s': %s","messagePattern":"Cannot drop namespace '(.+?)': (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":500,"severity":"error","filePath":"nessie/src/main/java/org/apache/iceberg/nessie/NessieIcebergClient.java","lineNumber":352,"sourceCode":"        commitRetry(\"drop namespace \" + key, Operation.Delete.of(key));\n        return true;\n      } catch (NessieReferenceConflictException e) {\n        Optional<Conflict> conflict =\n            NessieUtil.extractSingleConflict(\n                e,\n                EnumSet.of(\n                    Conflict.ConflictType.KEY_DOES_NOT_EXIST,\n                    Conflict.ConflictType.NAMESPACE_NOT_EMPTY));\n        if (conflict.isPresent()) {\n          Conflict.ConflictType conflictType = conflict.get().conflictType();\n          switch (conflictType) {\n            case KEY_DOES_NOT_EXIST:\n              return false;\n            case NAMESPACE_NOT_EMPTY:\n              throw new NamespaceNotEmptyException(e, \"Namespace '%s' is not empty.\", namespace);\n          }\n        }\n        throw new UncheckedIOException(\n            String.format(\"Cannot drop namespace '%s': %s\", namespace, e.getMessage()), e);\n      }\n    } catch (NessieNotFoundException e) {\n      LOG.error(\n          \"Cannot drop namespace '{}': ref '{}' is no longer valid.\",\n          namespace,\n          getRef().getName(),\n          e);\n    } catch (BaseNessieClientServerException e) {\n      throw new UncheckedIOException(\n          String.format(\"Cannot drop namespace '%s': %s\", namespace, e.getMessage()), e);\n    }\n    return false;\n  }\n\n  private static void checkNamespaceIsValid(Namespace namespace) {\n    if (namespace.isEmpty()) {\n      throw new NoSuchNamespaceException(\"Invalid namespace: %s\", namespace);","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/nessie/src/main/java/org/apache/iceberg/nessie/NessieIcebergClient.java#L334-L370","documentation":"Fallback handler in dropNamespace: when a NessieReferenceConflictException carries an unrecognized conflict (or multiple/unextractable conflicts), it is rethrown as UncheckedIOException 'Cannot drop namespace X: <server message>'. The server rejected the delete commit for a reason the client does not specially classify.","triggerScenarios":"Calling dropNamespace when the server returns a conflict type other than KEY_DOES_NOT_EXIST or NAMESPACE_NOT_EMPTY (e.g. unexpected concurrent mutation, server-side validation conflicts).","commonSituations":"Heavy concurrent commits on the same ref; Nessie server version emitting new conflict types unknown to the client.","solutions":["Inspect the wrapped cause (NessieReferenceConflictException) and server message for the actual conflict.","Retry the drop after concurrent operations on the ref settle.","Upgrade iceberg-nessie to a client version matching your Nessie server.","Update ref contents via the Nessie API directly if the conflict needs manual resolution."],"exampleFix":"// before\ncatalog.dropNamespace(ns); // UncheckedIOException on unknown conflict\n// after\ntry {\n  catalog.dropNamespace(ns);\n} catch (UncheckedIOException e) {\n  LOG.warn(\"drop conflict: {}\", e.getCause(), e);\n  // re-inspect ref state, then retry\n}","handlingStrategy":"retry","validationCode":"// minimize race window: re-read ref state immediately before drop\nContent c = api.getContent().reference(ref).key(key).get().get(key);","typeGuard":null,"tryCatchPattern":"try {\n  return catalog.dropNamespace(ns);\n} catch (UncheckedIOException e) {\n  if (e.getCause() instanceof NessieReferenceConflictException && attempt < 3) {\n    return dropNamespaceWithRetry(ns, attempt + 1); // bounded retry after conflict\n  }\n  throw e;\n}","preventionTips":["Serialize namespace DDL on a ref (avoid parallel drop/create on same keys).","Keep client and server versions current so all conflict types are recognized.","Log the full cause chain for unclassified conflicts."],"tags":["nessie","namespace","conflict","concurrency"],"backgroundTag":"http-error-response","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}