pentaho/pentaho-kettle · error · MetaStoreDependenciesExistsException

Unable to delete the meta store namespace

Error message

Unable to delete the meta store namespace '<namespace>' as it still contains element types

What it means

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.

Solutions

  1. Delete all element types in the namespace first (iterate getElementTypeIds(namespace) and call deleteElementType) then delete the namespace.
  2. If the data is disposable, remove the whole embedded store backing and recreate it.
  3. Inspect the dependency list in MetaStoreDependenciesExistsException to see what blocks the deletion.

Example fix

// before
metastore.deleteNamespace("myNamespace"); // throws if element types exist
// after
for (String id : metastore.getElementTypeIds("myNamespace")) {
  metastore.deleteElementType("myNamespace", id);
}
metastore.deleteNamespace("myNamespace");
Defensive patterns

Strategy: validation

Validate before calling

if (!metastore.getElementTypeIds(namespace).isEmpty()) {
  throw new IllegalStateException("Namespace still has element types; delete them first");
}

Try / catch

try { metastore.deleteNamespace(ns); } catch (MetaStoreDependenciesExistsException e) { e.getDependencies().forEach(id -> metastore.deleteElementType(ns, id)); metastore.deleteNamespace(ns); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/6a24382af512d76a. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/core/attributes/metastore/EmbeddedMetaStore.java:110

          .toList();
      }
    } );
  }

  @Override public boolean namespaceExists( final String namespace ) throws MetaStoreException {
    return MetaStoreUtil.executeLockedOperation( readLock(), new Callable<Boolean>() {
      @Override public Boolean call() throws Exception {
        return attributesInterface.getAttributesMap().containsKey( JsonElementType.groupName( namespace ) );
      }
    } );
  }

  @Override public synchronized void deleteNamespace( final String namespace ) throws MetaStoreException {
    MetaStoreUtil.executeLockedOperation( writeLock(), new Callable<Void>() {
      @Override public Void call() throws Exception {
        List<String> dependencies = getElementTypeIds( namespace );
        if ( !dependencies.isEmpty() ) {
          throw new MetaStoreDependenciesExistsException( dependencies,
            "Unable to delete the meta store namespace '" + namespace + "' as it still contains element types" );
        }
        attributesInterface.getAttributesMap().remove( JsonElementType.groupName( namespace ) );
        return null;
      }
    } );
  }

  @Override
  public JsonElementType newElementType( final String namespace ) {
    return new EmbeddedElementType( namespace );
  }

  private class EmbeddedElementType extends JsonElementType {
    public EmbeddedElementType( String namespace ) {
      super( namespace );
    }

View on GitHub (pinned to f3058517a1)