pentaho/pentaho-kettle · error · KettleException
Unexpected error deleting repository directory:
Error message
Unexpected error deleting repository directory:
What it means
Generic wrapper KettleException thrown by delRepositoryDirectory for any exception raised while deleting a directory (including failures in the delete/commit calls themselves). Unlike the 'not empty' guard, this wraps unexpected errors: database failures, rollback issues, or errors from directoryDelegate.deleteDirectory. The cause carries the actual problem.
Solutions
- Inspect e.getCause() for the real SQLException and address it (connectivity, privileges, constraints)
- Retry the deletion after restoring the repository connection
- Check the repository DB user has DELETE privileges on r_directory and dependent tables
- Delete or cascade-clean dependent rows (trans/jobs/subdirs) before deleting
Example fix
// before
repository.delRepositoryDirectory( dir, true );
// after
try {
repository.delRepositoryDirectory( dir, true );
} catch ( KettleException e ) {
log.error( "Delete failed: ", e.getCause() ); // check DB connectivity/privileges, then retry
} Defensive patterns
Strategy: try-catch
Validate before calling
// ensure DB reachable and user has DELETE rights before delete repository.connect( ... ); // throws early if unreachable
Try / catch
try {
repository.delRepositoryDirectory( dir, recursive );
} catch ( KettleException e ) {
log.error( "Directory delete failed", e.getCause() );
// retry after reconnect; check DB privileges/constraints
} Prevention
- Always inspect getCause(); the message itself carries no detail
- Verify the repository DB user has DELETE privileges on r_directory and dependents
- Retry transient connection failures with backoff
- Delete dependent rows/children before the parent directory
When it happens
Trigger: delRepositoryDirectory(dir, deleteNonEmptyFolder) where the deleteDirectory DB call, repository.commit(), or a nested recursive deletion fails: connection loss, foreign-key constraints, permission issues on the repository tables.
Common situations: Repository RDBMS connection dropped mid-delete; foreign-key rows in dependent tables blocking deletion; another client concurrently modifying the directory; insufficient DB user privileges to delete rows.
Related errors
- Database.Exception.UnableToDisableAutoCommit
- Database.Exception.UnableToEnableAutoCommit
- Database.Exception.UnableToReleaseSavepoint
- Database.Exception.UnableToRollbackToSavepoint
- Database.Exception.UnableToSetSavepoint
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/1fd24ad15d493825.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryDirectoryDelegate.java:325
try {
if ( !deleteNonEmptyFolder ) {
String[] trans = repository.getTransformationNames( dir.getObjectId(), false ); // TODO : include or exclude
// deleted objects?
String[] jobs = repository.getJobNames( dir.getObjectId(), false ); // TODO : include or exclude deleted
// objects?
ObjectId[] subDirectories = repository.getSubDirectoryIDs( dir.getObjectId() );
if ( trans.length == 0 && jobs.length == 0 && subDirectories.length == 0 ) {
repository.directoryDelegate.deleteDirectory( dir.getObjectId() );
repository.commit();
} else {
throw new KettleException( "This directory is not empty!" );
}
} else {
repository.directoryDelegate.deleteDirectory( dir );
repository.commit();
}
} catch ( Exception e ) {
throw new KettleException( "Unexpected error deleting repository directory:", e );
}
}
/**
* @deprecated use {@link #renameRepositoryDirectory(ObjectId, RepositoryDirectoryInterface, String)}
*
* @param dir
* @return
* @throws KettleException
*/
@Deprecated
public ObjectId renameRepositoryDirectory( RepositoryDirectory dir ) throws KettleException {
try {
renameDirectory( dir.getObjectId(), null, dir.getName() );
return dir.getObjectId(); // doesn't change in this specific case.
} catch ( Exception e ) {
throw new KettleException( "Unable to rename the specified repository directory [" + dir + "]", e );
}View on GitHub (pinned to f3058517a1)