{"record":{"id":"ce775b283c51c326","repo":"pentaho/pentaho-kettle","slug":"unable-to-delete-namespace-namespace","errorCode":null,"errorMessage":"Unable to delete namespace ''+namespace+''","messagePattern":"Unable to delete namespace ''\\+namespace\\+''","errorType":"exception","errorClass":"MetaStoreException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java","lineNumber":119,"sourceCode":"        for ( IMetaStoreElementType elementType : elementTypes ) {\n          dependencies.add( elementType.getId() );\n        }\n        throw new MetaStoreDependenciesExistsException( dependencies, \"The namespace to delete, '\"\n          + namespace + \"' is not empty\" );\n      }\n\n      // Now delete the namespace\n      //\n      delegate.deleteNamespace( namespaceId );\n      repository.commit();\n    } catch ( MetaStoreDependenciesExistsException e ) {\n      throw e;\n    } catch ( MetaStoreException e ) {\n      repository.rollback();\n      throw e;\n    } catch ( Exception e ) {\n      repository.rollback();\n      throw new MetaStoreException( \"Unable to delete namespace '\" + namespace + \"'\", e );\n    }\n  }\n\n  @Override\n  public boolean namespaceExists( String namespace ) throws MetaStoreException {\n    try {\n      return delegate.getNamespaceId( namespace ) != null;\n    } catch ( Exception e ) {\n      throw new MetaStoreException( \"Unable to verify if namespace '\" + namespace + \"' exists.\", e );\n    }\n  }\n\n  // Handle the element types\n\n  public void createElementType( String namespace, IMetaStoreElementType elementType ) throws MetaStoreException,\n    MetaStoreElementTypeExistsException {\n    try {\n","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/metastore/KettleDatabaseRepositoryMetaStore.java#L101-L137","documentation":"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.","triggerScenarios":"metastore.deleteNamespace(name) when delegate.deleteNamespace(namespaceId) or the surrounding JDBC work throws a non-MetaStore exception (SQL error, connection loss, lock timeout).","commonSituations":"Database connection dropped mid-delete; DB user lacking DELETE privilege on R_NAMESPACE; row locked by another session.","solutions":["Check the chained cause for the underlying SQL error","Verify the repository DB user has DELETE privileges on the metastore tables","Check for concurrent sessions/locks on R_NAMESPACE and retry once connectivity is restored"],"exampleFix":"// before\nmetaStore.deleteNamespace(ns); // may fail silently in caller's design\n// after\ntry {\n  metaStore.deleteNamespace(ns);\n} catch (MetaStoreException e) {\n  // transaction was rolled back; namespace still intact\n  logError(\"Delete failed, cause: \" + e.getCause().getMessage());\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// preconditions: no children and DB reachable\nif (!metaStore.namespaceExists(namespace)) return; // nothing to delete\nassertRepositoryConnectionOpen(repository);","typeGuard":null,"tryCatchPattern":"try { metaStore.deleteNamespace(ns); } catch (MetaStoreException e) { // rollback already done\n  retryAfterDelay(() -> metaStore.deleteNamespace(ns));\n}","preventionTips":["Grant the repository DB user DELETE privileges on metastore tables","Monitor DB connectivity in long-running jobs","Retry transient SQL failures; a rollback leaves state consistent"],"tags":["metastore","database","delete","rollback"],"backgroundTag":"database-query-failed","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"}