{"record":{"id":"557a09c0d52144ee","repo":"apache/iceberg","slug":"failed-to-drop-namespace-namespace-in-hive-metas","errorCode":null,"errorMessage":"Failed to drop namespace <namespace> in Hive Metastore","messagePattern":"Failed to drop namespace <namespace> in Hive Metastore","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java","lineNumber":620,"sourceCode":"                namespace.level(0),\n                false /* deleteData */,\n                false /* ignoreUnknownDb */,\n                false /* cascade */);\n            return null;\n          });\n\n      LOG.info(\"Dropped namespace: {}\", namespace);\n      return true;\n\n    } catch (InvalidOperationException e) {\n      throw new NamespaceNotEmptyException(\n          e, \"Namespace %s is not empty. One or more tables exist.\", namespace);\n\n    } catch (NoSuchObjectException e) {\n      return false;\n\n    } catch (TException e) {\n      throw new RuntimeException(\"Failed to drop namespace \" + namespace + \" in Hive Metastore\", e);\n\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\n          \"Interrupted in call to drop dropDatabase(name) \" + namespace + \" in Hive Metastore\", e);\n    }\n  }\n\n  @Override\n  public boolean setProperties(Namespace namespace, Map<String, String> properties) {\n    Preconditions.checkArgument(\n        (properties.get(HMS_DB_OWNER_TYPE) == null) == (properties.get(HMS_DB_OWNER) == null),\n        \"Setting %s and %s has to be performed together or not at all\",\n        HMS_DB_OWNER_TYPE,\n        HMS_DB_OWNER);\n    Map<String, String> parameter = Maps.newHashMap();\n\n    parameter.putAll(loadNamespaceMetadata(namespace));","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L602-L638","documentation":"dropNamespace wraps a generic Thrift TException from dropDatabase in a RuntimeException indicating the namespace could not be dropped in the Hive Metastore. Note NoSuchObjectException is handled separately (returns false), so this means an unexpected metastore failure.","triggerScenarios":"catalog.dropNamespace(...) when the metastore throws TException — connectivity failure, permissions on the database location, or metastore-side error during dropDatabase.","commonSituations":"Metastore unreachable mid-operation; insufficient privileges to drop the database or its HDFS location; HDFS/Warehouse path issues during managed-database removal.","solutions":["Inspect the chained cause and verify metastore connectivity and health","Check that the caller has permission to drop the database in Hive/Ranger policies","Retry the drop once the metastore is healthy; check whether the database still exists afterwards"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure privileges and metastore health before dropping\ncatalog.loadTable(...); // probe connectivity","typeGuard":null,"tryCatchPattern":"try {\n  catalog.dropNamespace(ns, false);\n} catch (RuntimeException e) {\n  LOG.error(\"Drop failed; cause: {}\", e.getCause(), e);\n  throw e;\n}","preventionTips":["Confirm Hive/Ranger drop permissions on the database","Verify metastore connectivity before bulk cleanup jobs","Re-check namespaceExists after a failed drop"],"tags":["hive-metastore","thrift","drop","connectivity"],"backgroundTag":"database-write-failed","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"}