pentaho/pentaho-kettle · error · KettleException

You are not allowed to delete your home folder.

Error message

You are not allowed to delete your home folder.

What it means

deleteRepositoryDirectory protects the current user's home folder: if the folder to delete is the same as, or an ancestor of, the user's own home folder, a KettleException "You are not allowed to delete your home folder." is thrown before any deletion occurs.

Solutions

  1. Exclude the current user's home folder (and its ancestors) from the deletion set.
  2. Compare folder.getPath() against ClientRepositoryPaths.getUserHomeFolderPath(user.getLogin()) before deleting.
  3. Delete only leaf content inside the home folder, not the folder itself.

Example fix

// before
repo.deleteRepositoryDirectory(dir, true);
// after
if (!folder.getPath().startsWith("/home/" + user.getLogin())) { repo.deleteRepositoryDirectory(dir, true); }
Defensive patterns

Strategy: validation

Validate before calling

String home = "/home/" + user.getLogin(); if (folder.getPath().equals(home) || home.startsWith(folder.getPath())) throw new IllegalArgumentException("refusing to delete own home folder");

Try / catch

try { repo.deleteRepositoryDirectory(dir, true); } catch (KettleException e) { if (e.getMessage().contains("home folder")) skipHome(folder); else throw e; }

Prevention

When it happens

Trigger: Calling deleteRepositoryDirectory(dir, ...) where dir resolves to /home/<your-username> itself or any parent of it (e.g. attempting to delete /home while logged in as that user).

Common situations: Cleanup scripts that recursively delete from /home and reach the operator's own home folder; users with admin rights accidentally deleting their own home via scripts.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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

Appendix: source

Thrown at plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java:572

  @Override
  public void deleteRepositoryDirectory( final RepositoryDirectoryInterface dir, final boolean deleteHomeDirectories )
    throws KettleException {

    readWriteLock.writeLock().lock();
    try {
      // Fetch the folder to be deleted
      RepositoryFile folder;
      RepositoryFile homeFolder;

      folder = pur.getFileById( dir.getObjectId().getId() );
      // Fetch the user's home directory
      homeFolder = pur.getFile( ClientRepositoryPaths.getUserHomeFolderPath( user.getLogin() ) );

      // Make sure the user is not trying to delete their own home directory
      if ( isSameOrAncestorFolder( folder, homeFolder ) ) {
        // Then throw an exception that the user cannot delete their own home directory
        throw new KettleException( "You are not allowed to delete your home folder." );
      }

      if ( !deleteHomeDirectories && isUserHomeDirectory( folder ) ) {
        throw new RepositoryObjectAccessException( "Cannot delete another users home directory",
          RepositoryObjectAccessException.AccessExceptionType.USER_HOME_DIR );
      }

      pur.deleteFile( dir.getObjectId().getId(), null );
      rootRef.clearRef();
    } catch ( Exception e ) {
      throw new KettleException( "Unable to delete directory with path [" + getPath( null, dir, null ) + "]", e );
    } finally {
      readWriteLock.writeLock().unlock();
    }
  }

  @Override
  public ObjectId renameRepositoryDirectory( final ObjectId dirId, final RepositoryDirectoryInterface newParent,

View on GitHub (pinned to f3058517a1)