{"record":{"id":"8d599966ab165f66","repo":"pentaho/pentaho-kettle","slug":"unable-to-delete-directory-with-path","errorCode":null,"errorMessage":"Unable to delete directory with path [","messagePattern":"Unable to delete directory with path \\[","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":583,"sourceCode":"      folder = pur.getFileById( dir.getObjectId().getId() );\n      // Fetch the user's home directory\n      homeFolder = pur.getFile( ClientRepositoryPaths.getUserHomeFolderPath( user.getLogin() ) );\n\n      // Make sure the user is not trying to delete their own home directory\n      if ( isSameOrAncestorFolder( folder, homeFolder ) ) {\n        // Then throw an exception that the user cannot delete their own home directory\n        throw new KettleException( \"You are not allowed to delete your home folder.\" );\n      }\n\n      if ( !deleteHomeDirectories && isUserHomeDirectory( folder ) ) {\n        throw new RepositoryObjectAccessException( \"Cannot delete another users home directory\",\n          RepositoryObjectAccessException.AccessExceptionType.USER_HOME_DIR );\n      }\n\n      pur.deleteFile( dir.getObjectId().getId(), null );\n      rootRef.clearRef();\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to delete directory with path [\" + getPath( null, dir, null ) + \"]\", e );\n    } finally {\n      readWriteLock.writeLock().unlock();\n    }\n  }\n\n  @Override\n  public ObjectId renameRepositoryDirectory( final ObjectId dirId, final RepositoryDirectoryInterface newParent,\n                                             final String newName ) throws KettleException {\n    return renameRepositoryDirectory( dirId, newParent, newName, false );\n  }\n\n  @Override\n  public ObjectId renameRepositoryDirectory( final ObjectId dirId, final RepositoryDirectoryInterface newParent,\n                                             final String newName, final boolean renameHomeDirectories )\n    throws KettleException {\n    // dir ID is used to find orig obj; new parent is used as new parent (might be null meaning no change in parent);\n    // new name is used as new file name (might be null meaning no change in name)\n    String finalName = null;","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L565-L601","documentation":"Catch-all wrapper in deleteRepositoryDirectory: any exception from the guards above or from pur.deleteFile is wrapped as \"Unable to delete directory with path [...]\" with the root cause chained; the write lock is released in finally.","triggerScenarios":"pur.deleteFile fails — the caller lacks delete permission, the folder contains undeletable content, the ObjectId is stale after concurrent modification, or a JCR/server error occurs; also wraps RepositoryObjectAccessException from the home-folder guards into a KettleException.","commonSituations":"Deleting folders under /public without delete ACLs; another client moved/deleted the folder first; recursive deletions partially failing mid-tree.","solutions":["Inspect e.getCause() — if it is RepositoryObjectAccessException USER_HOME_DIR, honor it and skip the folder.","Verify the user has delete permission on the folder (PUC security settings).","Re-fetch the directory to refresh its ObjectId before retrying the delete.","Delete children individually if a server-side constraint blocks the recursive delete."],"exampleFix":"// before\nrepo.deleteRepositoryDirectory(dir, true);\n// after\ntry { repo.deleteRepositoryDirectory(repo.findDirectory(dir.getPath()), true); } catch (KettleException e) { logger.warn(\"delete {} failed: {}\", dir.getPath(), e.getCause()); }","handlingStrategy":"try-catch","validationCode":"if (repo.findDirectory(dir.getPath()) == null) return; // already gone","typeGuard":null,"tryCatchPattern":"try { repo.deleteRepositoryDirectory(dir, true); } catch (KettleException e) { Throwable c = e.getCause(); if (c instanceof RepositoryObjectAccessException) handleAccess((RepositoryObjectAccessException) c); else retryWithFreshObjectId(dir); }","preventionTips":["Re-fetch the directory to refresh ObjectId before deleting","Check delete ACLs beforehand","In recursive deletions, catch per-folder and continue"],"tags":["pentaho","repository","directory"],"backgroundTag":"file-delete-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"}