{"record":{"id":"37442e9bb7a355ca","repo":"pentaho/pentaho-kettle","slug":"unable-to-move-rename-directory-with-id","errorCode":null,"errorMessage":"Unable to move/rename directory with id [","messagePattern":"Unable to move/rename directory with id \\[","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":632,"sourceCode":"      interimFolderPath = getParentPath( folder.getPath() );\n      finalParentPath = ( newParent != null ? getPath( null, newParent, null ) : interimFolderPath );\n      // Make sure the user is not trying to move their own home directory\n      if ( isSameOrAncestorFolder( folder, homeFolder ) ) {\n        // Then throw an exception that the user cannot move their own home directory\n        throw new KettleException( \"You are not allowed to move/rename your home folder.\" );\n      }\n\n      if ( !renameHomeDirectories && isUserHomeDirectory( folder ) ) {\n        throw new RepositoryObjectAccessException( \"Cannot move another users home directory\",\n          RepositoryObjectAccessException.AccessExceptionType.USER_HOME_DIR );\n      }\n\n      pur.moveFile( dirId.getId(), finalParentPath + RepositoryFile.SEPARATOR + finalName, null );\n\n      rootRef.clearRef();\n      return dirId;\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to move/rename directory with id [\" + dirId + \"] to new parent [\"\n        + finalParentPath + \"] and new name [\" + finalName + \"]\", e );\n    } finally {\n      readWriteLock.writeLock().unlock();\n    }\n  }\n\n  protected RepositoryFileTree loadRepositoryFileTree( String path ) {\n    readWriteLock.readLock().lock();\n    RepositoryFileTree result;\n    try {\n      result = pur.getTree( path, -1, null, true );\n    } finally {\n      readWriteLock.readLock().unlock();\n    }\n\n    return result;\n  }\n","sourceCodeStart":614,"sourceCodeEnd":650,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L614-L650","documentation":"Generic wrapper failure of renameRepositoryDirectory: after attempting pur.moveFile on the repository file backing the directory, any exception is rethrown as a KettleException naming the directory id, new parent path, and new name. It means the server-side move/rename of the repository directory failed for any reason (network, permissions, missing folder, duplicate name).","triggerScenarios":"Calling renameRepositoryDirectory(ObjectId, RepositoryDirectoryInterface, String) when the underlying pur.moveFile throws — e.g. the dirId no longer exists, target path already exists, or the JCR/PUR service call fails. The write lock is held during the call.","commonSituations":"Concurrent deletion of the directory by another client; renaming to a name that already exists in the target parent; session/credentials expired against the BA server; network interruption to the enterprise repository.","solutions":["Check the cause (e.getCause()) to find the real server-side failure and address it (missing file, duplicate name, permissions).","Verify the directory id still exists and the target parent exists before renaming.","Ensure the new name does not collide with an existing sibling; pick a unique name.","Re-authenticate/reconnect to the PUR repository and retry."],"exampleFix":"// before\nrepo.renameRepositoryDirectory(id, parent, name);\n// after\ntry {\n  repo.renameRepositoryDirectory(id, parent, name);\n} catch (KettleException e) {\n  throw new KettleException(\"Rename of \" + id + \" failed: \" + e.getCause(), e);\n}","handlingStrategy":"try-catch","validationCode":"if (repo.getRepositoryDirectoryTree().findDirectory(dirId) == null) {\n  throw new KettleException(\"Directory \" + dirId + \" no longer exists\");\n}","typeGuard":"null","tryCatchPattern":"try {\n  repo.renameRepositoryDirectory(dirId, newParent, newName);\n} catch (KettleException e) {\n  Throwable cause = e.getCause();\n  log.error(\"Rename of {} failed: {}\", dirId, cause, e);\n  throw e;\n}","preventionTips":["Ensure target names are unique among siblings before renaming.","Do not delete directories concurrently with rename operations.","Keep the repository session alive; re-login on authentication failures."],"tags":["repository","rename","pentaho","move-file"],"backgroundTag":"api-request-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"}