pentaho/pentaho-kettle · warning · MetaStoreDependenciesExistsException

The namespace to delete, ''+namespace+'' is not empty

Error message

The namespace to delete, ''+namespace+'' is not empty

What it means

deleteNamespace() refuses to remove a namespace that still contains element types. It collects the ids of remaining element types and throws MetaStoreDependenciesExistsException('The namespace to delete, X is not empty', dependencies). This protects dependent metadata from being orphaned.

Solutions

  1. Delete all element types in the namespace first (list via getElementTypes, deleteElementType each), then delete the namespace
  2. Inspect the exception's dependencies list to know exactly which element types block deletion
  3. Move needed element types to another namespace before deleting

Example fix

// before
metaStore.deleteNamespace("old-ns"); // throws if not empty
// after
for (IMetaStoreElementType t : metaStore.getElementTypes("old-ns")) {
  metaStore.deleteElementType("old-ns", t);
}
metaStore.deleteNamespace("old-ns");
Defensive patterns

Strategy: validation

Validate before calling

List<IMetaStoreElementType> types = metaStore.getElementTypes(namespace);
if (!types.isEmpty()) {
  types.forEach(t -> { try { metaStore.deleteElementType(namespace, t); } catch (MetaStoreException e) { throw new RuntimeException(e); } });
}

Try / catch

try { metaStore.deleteNamespace(ns); } catch (MetaStoreDependenciesExistsException e) { e.getDependencies().forEach(id -> log("Blocked by element type: " + id)); }

Prevention

When it happens

Trigger: metastore.deleteNamespace(name) when getElementTypes(namespace) returns a non-empty list — the namespace still has element types defined in it.

Common situations: Trying to clean up a namespace that still holds shared metadata; deleting namespaces out of dependency order; leftovers from a previous application version.

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/1086f383fa830681. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java:104

    } catch ( Exception e ) {
      repository.rollback();
      throw new MetaStoreException( e );
    }
  }

  @Override
  public void deleteNamespace( String namespace ) throws MetaStoreException, MetaStoreDependenciesExistsException {
    try {
      ObjectId namespaceId = delegate.verifyNamespace( namespace );

      List<IMetaStoreElementType> elementTypes = getElementTypes( namespace );
      if ( !elementTypes.isEmpty() ) {

        List<String> dependencies = new ArrayList<String>();
        for ( IMetaStoreElementType elementType : elementTypes ) {
          dependencies.add( elementType.getId() );
        }
        throw new MetaStoreDependenciesExistsException( dependencies, "The namespace to delete, '"
          + namespace + "' is not empty" );
      }

      // Now delete the namespace
      //
      delegate.deleteNamespace( namespaceId );
      repository.commit();
    } catch ( MetaStoreDependenciesExistsException e ) {
      throw e;
    } catch ( MetaStoreException e ) {
      repository.rollback();
      throw e;
    } catch ( Exception e ) {
      repository.rollback();
      throw new MetaStoreException( "Unable to delete namespace '" + namespace + "'", e );
    }
  }

View on GitHub (pinned to f3058517a1)