{"record":{"id":"9a3bcdbcd41a0448","repo":"pentaho/pentaho-kettle","slug":"unable-to-rename-the-specified-repository-directory-dir","errorCode":null,"errorMessage":"Unable to rename the specified repository directory [dir]","messagePattern":"Unable to rename the specified repository directory \\[dir\\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryDirectoryDelegate.java","lineNumber":342,"sourceCode":"    } catch ( Exception e ) {\n      throw new KettleException( \"Unexpected error deleting repository directory:\", e );\n    }\n  }\n\n  /**\n   * @deprecated use {@link #renameRepositoryDirectory(ObjectId, RepositoryDirectoryInterface, String)}\n   *\n   * @param dir\n   * @return\n   * @throws KettleException\n   */\n  @Deprecated\n  public ObjectId renameRepositoryDirectory( RepositoryDirectory dir ) throws KettleException {\n    try {\n      renameDirectory( dir.getObjectId(), null, dir.getName() );\n      return dir.getObjectId(); // doesn't change in this specific case.\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to rename the specified repository directory [\" + dir + \"]\", e );\n    }\n  }\n\n  public ObjectId renameRepositoryDirectory( ObjectId id, RepositoryDirectoryInterface newParentDir, String newName ) throws KettleException {\n    ObjectId parentId = null;\n    if ( newParentDir != null ) {\n      parentId = newParentDir.getObjectId();\n    }\n\n    try {\n      renameDirectory( id, parentId, newName );\n      return id; // doesn't change in this specific case.\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to rename the specified repository directory [\" + id + \"]\", e );\n    }\n  }\n\n  /**","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryDirectoryDelegate.java#L324-L360","documentation":"Wrapper KettleException from the deprecated renameRepositoryDirectory(RepositoryDirectory) method, thrown when the internal renameDirectory call fails for any reason. Since it passes a null parent id, it performs a name-only rename; all validation failures from renameDirectory (self-parent, descendant cycle, duplicate name) or DB errors surface wrapped here.","triggerScenarios":"Calling repository.renameRepositoryDirectory(dir) (deprecated overload) when: the new name collides with a sibling, the directory ObjectId is stale/missing, or the database update/commit fails.","commonSituations":"Legacy code still using the deprecated overload after upgrading Pentaho/Kettle; renaming a directory that was deleted by another client; name conflicts in shared repositories.","solutions":["Inspect e.getCause() to distinguish validation failure vs database failure","Migrate to the non-deprecated renameRepositoryDirectory(ObjectId, RepositoryDirectoryInterface, String)","Verify the directory still exists and the new name is unique among siblings before renaming","Check repository connectivity if the cause is a KettleDatabaseException"],"exampleFix":"// before\nrepository.renameRepositoryDirectory( dir ); // deprecated\n// after\nrepository.renameRepositoryDirectory( dir.getObjectId(), dir.getParent(), \"NewName\" );","handlingStrategy":"try-catch","validationCode":"// avoid the deprecated overload entirely; use:\n// repository.renameRepositoryDirectory( dir.getObjectId(), dir.getParent(), newName );","typeGuard":null,"tryCatchPattern":"try {\n  repository.renameRepositoryDirectory( dir );\n} catch ( KettleException e ) {\n  Throwable cause = e.getCause();\n  // duplicate-name vs database failure: branch on cause/message\n}","preventionTips":["Migrate off the deprecated renameRepositoryDirectory(RepositoryDirectory) overload","Verify the directory ObjectId is still valid (tree refresh) before renaming","Check sibling names for uniqueness before rename"],"tags":["deprecated-api","directory-rename","kettle-exception"],"backgroundTag":"deprecated-api-usage","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"}