{"record":{"id":"99e640c237f1ecdb","repo":"pentaho/pentaho-kettle","slug":"unable-to-rename-the-specified-repository-directory-id","errorCode":null,"errorMessage":"Unable to rename the specified repository directory [id]","messagePattern":"Unable to rename the specified repository directory \\[id\\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryDirectoryDelegate.java","lineNumber":356,"sourceCode":"    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  /**\n   * Create a new directory, possibly by creating several sub-directies of / at the same time.\n   *\n   * @param parentDirectory\n   *          the parent directory\n   * @param directoryPath\n   *          The path to the new Repository Directory, to be created.\n   * @return The created sub-directory\n   * @throws KettleException\n   *           In case something goes wrong\n   */\n  public RepositoryDirectoryInterface createRepositoryDirectory( RepositoryDirectoryInterface parentDirectory,\n    String directoryPath ) throws KettleException {\n\n    // RepositoryDirectoryInterface refreshedParentDir =","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryDirectoryDelegate.java#L338-L374","documentation":"Wrapper KettleException from renameRepositoryDirectory(ObjectId, RepositoryDirectoryInterface, String), thrown when renameDirectory(id, parentId, newName) fails. The wrap message includes the ObjectId. All pre-checks in renameDirectory (self-parent, descendant cycle, duplicate child name) and database failures during the update surface here wrapped as the cause.","triggerScenarios":"repository.renameRepositoryDirectory(id, newParentDir, newName) where id equals the new parent id, the new parent is a descendant of id, the destination already has a child named newName, or the database update/commit fails.","commonSituations":"Programmatic reorganization scripts moving folders into their own subtrees; concurrent renames causing name collisions; stale ObjectIds from an outdated directory tree snapshot; DB connectivity problems.","solutions":["Validate before calling: new parent is not the directory itself and not inside its subtree","Ensure the target name is unique in the destination (findChild check)","Refresh the directory tree to obtain fresh ObjectIds if the tree changed concurrently","Inspect e.getCause() for database errors and fix connectivity/constraints"],"exampleFix":"// before\nrepo.renameRepositoryDirectory( id, newParent, name );\n// after\nif ( !id.equals( newParent.getObjectId() ) && newParent.findChild( name ) == null ) {\n  repo.renameRepositoryDirectory( id, newParent, name );\n} else {\n  log.warn( \"Invalid move: self-parent or name conflict\" );\n}","handlingStrategy":"validation","validationCode":"ObjectId parentId = newParentDir == null ? null : newParentDir.getObjectId();\nif ( parentId != null && ( parentId.equals( id ) || isDescendantOf( newParentDir, id ) ) ) {\n  throw new IllegalArgumentException( \"Invalid move target\" );\n}\nif ( newName != null && newParentDir != null && newParentDir.findChild( newName ) != null ) {\n  throw new IllegalArgumentException( \"Name conflict in destination\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  repo.renameRepositoryDirectory( id, newParentDir, newName );\n} catch ( KettleException e ) {\n  // branch on cause: validation message vs KettleDatabaseException\n}","preventionTips":["Pre-validate self-parent, descendant-cycle, and name-conflict conditions","Refresh the directory tree to avoid stale ObjectIds","Handle concurrent modifications by re-checking just before the call"],"tags":["directory-rename","validation","kettle-exception"],"backgroundTag":"invalid-state-transition","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"}