{"record":{"id":"8f6954b07ef4399d","repo":"pentaho/pentaho-kettle","slug":"namespace-namespace-can-not-be-deleted-because-it-is-not","errorCode":null,"errorMessage":"Namespace '${namespace} can not be deleted because it is not empty","messagePattern":"Namespace '(.+?) can not be deleted because it is not empty","errorType":"exception","errorClass":"MetaStoreDependenciesExistsException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/metastore/PurRepositoryMetaStore.java","lineNumber":125,"sourceCode":"  @Override\n  public void deleteNamespace( String namespace ) throws MetaStoreException {\n    RepositoryFile namespaceFile = getNamespaceRepositoryFile( namespace );\n    if ( namespaceFile == null ) {\n      return; // already gone.\n    }\n    List<RepositoryFile> children = getChildren( namespaceFile.getId() );\n    if ( children == null || children.isEmpty() ) {\n      // Delete the file, there are no children.\n      //\n      pur.deleteFile( namespaceFile.getId(), true, \"Delete namespace\" );\n    } else {\n      // Dependencies exists, throw an exception.\n      //\n      List<String> elementTypeIds = new ArrayList<String>();\n      for ( RepositoryFile child : children ) {\n        elementTypeIds.add( child.getId().toString() );\n      }\n      throw new MetaStoreDependenciesExistsException( elementTypeIds, \"Namespace '\" + namespace\n          + \" can not be deleted because it is not empty\" );\n    }\n  }\n\n  @Override\n  public List<String> getNamespaces() throws MetaStoreException {\n    List<String> namespaces = new ArrayList<String>();\n    List<RepositoryFile> children = getChildren( namespacesFolder.getId() );\n    for ( RepositoryFile child : children ) {\n      namespaces.add( child.getName() );\n    }\n    return namespaces;\n  }\n\n  // The element types\n\n  @Override\n  public void createElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/metastore/PurRepositoryMetaStore.java#L107-L143","documentation":"Thrown by PurRepositoryMetaStore.deleteNamespace() when the namespace folder still contains children (element types or elements), so deleting it would orphan dependencies. It is a MetaStoreDependenciesExistsException carrying the ids of the blocking children.","triggerScenarios":"Calling deleteNamespace(ns) while the namespace folder on the server still holds element-type folders or element files; hidden-file filtering doesn't empty the child list.","commonSituations":"Attempting a clean teardown of a namespace that still has element types; leftover server artifacts not visible in the PDI metastore explorer.","solutions":["Delete all element types and elements in the namespace first","Inspect the child ids from MetaStoreDependenciesExistsException to find blockers","Use the server UI to inspect and remove leftover folders under /etc/metastore/<ns>"],"exampleFix":"// before\nmetaStore.deleteNamespace( ns );\n// after\nfor ( String typeId : metaStore.getElementTypeNames( ns ) ) {\n  metaStore.deleteElementType( ns, metaStore.getElementTypeByName( ns, typeId ) );\n}\nmetaStore.deleteNamespace( ns );","handlingStrategy":"validation","validationCode":"if ( metaStore.getElementTypeNames( namespace ).length > 0 ) {\n  throw new IllegalStateException( \"Namespace not empty; delete types first\" );\n}","typeGuard":null,"tryCatchPattern":"try { metaStore.deleteNamespace( ns ); } catch ( MetaStoreDependenciesExistsException e ) { logError( \"Blocked by child ids: \" + e.getDependencies(), e ); }","preventionTips":["Empty the namespace before deleting it","Use the exception's dependency ids to find blockers","Inspect /etc/metastore on the server for hidden leftovers"],"tags":["metastore","namespace","dependencies"],"backgroundTag":"invalid-state-transition","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}