{"record":{"id":"6a24382af512d76a","repo":"pentaho/pentaho-kettle","slug":"unable-to-delete-the-meta-store-namespace-namespace-as-it","errorCode":null,"errorMessage":"Unable to delete the meta store namespace '<namespace>' as it still contains element types","messagePattern":"Unable to delete the meta store namespace '<namespace>' as it still contains element types","errorType":"exception","errorClass":"MetaStoreDependenciesExistsException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/core/attributes/metastore/EmbeddedMetaStore.java","lineNumber":110,"sourceCode":"          .toList();\n      }\n    } );\n  }\n\n  @Override public boolean namespaceExists( final String namespace ) throws MetaStoreException {\n    return MetaStoreUtil.executeLockedOperation( readLock(), new Callable<Boolean>() {\n      @Override public Boolean call() throws Exception {\n        return attributesInterface.getAttributesMap().containsKey( JsonElementType.groupName( namespace ) );\n      }\n    } );\n  }\n\n  @Override public synchronized void deleteNamespace( final String namespace ) throws MetaStoreException {\n    MetaStoreUtil.executeLockedOperation( writeLock(), new Callable<Void>() {\n      @Override public Void call() throws Exception {\n        List<String> dependencies = getElementTypeIds( namespace );\n        if ( !dependencies.isEmpty() ) {\n          throw new MetaStoreDependenciesExistsException( dependencies,\n            \"Unable to delete the meta store namespace '\" + namespace + \"' as it still contains element types\" );\n        }\n        attributesInterface.getAttributesMap().remove( JsonElementType.groupName( namespace ) );\n        return null;\n      }\n    } );\n  }\n\n  @Override\n  public JsonElementType newElementType( final String namespace ) {\n    return new EmbeddedElementType( namespace );\n  }\n\n  private class EmbeddedElementType extends JsonElementType {\n    public EmbeddedElementType( String namespace ) {\n      super( namespace );\n    }\n","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/core/attributes/metastore/EmbeddedMetaStore.java#L92-L128","documentation":"EmbeddedMetaStore.deleteNamespace() refuses to delete a namespace that still contains element types, throwing MetaStoreDependenciesExistsException with the list of dependent element type ids. The store protects against silently orphaning element types that live in the same attributes map.","triggerScenarios":"Calling metastore.deleteNamespace(namespace) when getElementTypeIds(namespace) returns a non-empty list — i.e. element types were created in that namespace and never deleted first.","commonSituations":"Trying to reset an embedded metastore (inside a repository or file) without cleaning up element types; cleanup scripts that delete namespaces directly while shared objects still reference them.","solutions":["Delete all element types in the namespace first (iterate getElementTypeIds(namespace) and call deleteElementType) then delete the namespace.","If the data is disposable, remove the whole embedded store backing and recreate it.","Inspect the dependency list in MetaStoreDependenciesExistsException to see what blocks the deletion."],"exampleFix":"// before\nmetastore.deleteNamespace(\"myNamespace\"); // throws if element types exist\n// after\nfor (String id : metastore.getElementTypeIds(\"myNamespace\")) {\n  metastore.deleteElementType(\"myNamespace\", id);\n}\nmetastore.deleteNamespace(\"myNamespace\");","handlingStrategy":"validation","validationCode":"if (!metastore.getElementTypeIds(namespace).isEmpty()) {\n  throw new IllegalStateException(\"Namespace still has element types; delete them first\");\n}","typeGuard":null,"tryCatchPattern":"try { metastore.deleteNamespace(ns); } catch (MetaStoreDependenciesExistsException e) { e.getDependencies().forEach(id -> metastore.deleteElementType(ns, id)); metastore.deleteNamespace(ns); }","preventionTips":["Always drain element types before namespace deletion","Treat embedded metastore namespaces as dependent graphs, not flat maps","Catch MetaStoreDependenciesExistsException and use its dependency list"],"tags":["metastore","dependency","namespace"],"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"}