pentaho/pentaho-kettle · error · MetaStoreException

Unable to delete namespace ''+namespace+''

Error message

Unable to delete namespace ''+namespace+''

What it means

deleteNamespace() catches any generic Exception during namespace removal, performs repository.rollback(), and rethrows it as MetaStoreException('Unable to delete namespace X', cause). It means the delete operation itself failed at the database level and the transaction was rolled back.

Solutions

  1. Check the chained cause for the underlying SQL error
  2. Verify the repository DB user has DELETE privileges on the metastore tables
  3. Check for concurrent sessions/locks on R_NAMESPACE and retry once connectivity is restored

Example fix

// before
metaStore.deleteNamespace(ns); // may fail silently in caller's design
// after
try {
  metaStore.deleteNamespace(ns);
} catch (MetaStoreException e) {
  // transaction was rolled back; namespace still intact
  logError("Delete failed, cause: " + e.getCause().getMessage());
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// preconditions: no children and DB reachable
if (!metaStore.namespaceExists(namespace)) return; // nothing to delete
assertRepositoryConnectionOpen(repository);

Try / catch

try { metaStore.deleteNamespace(ns); } catch (MetaStoreException e) { // rollback already done
  retryAfterDelay(() -> metaStore.deleteNamespace(ns));
}

Prevention

When it happens

Trigger: metastore.deleteNamespace(name) when delegate.deleteNamespace(namespaceId) or the surrounding JDBC work throws a non-MetaStore exception (SQL error, connection loss, lock timeout).

Common situations: Database connection dropped mid-delete; DB user lacking DELETE privilege on R_NAMESPACE; row locked by another session.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

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

        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 );
    }
  }

  @Override
  public boolean namespaceExists( String namespace ) throws MetaStoreException {
    try {
      return delegate.getNamespaceId( namespace ) != null;
    } catch ( Exception e ) {
      throw new MetaStoreException( "Unable to verify if namespace '" + namespace + "' exists.", e );
    }
  }

  // Handle the element types

  public void createElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException,
    MetaStoreElementTypeExistsException {
    try {

View on GitHub (pinned to f3058517a1)