{"record":{"id":"cfc7059da5ce191a","repo":"pentaho/pentaho-kettle","slug":"unable-to-rename-object-with-id-id-to-newname","errorCode":null,"errorMessage":"Unable to rename object with ID [ + id + ] to [ + newName + ]","messagePattern":"Unable to rename object with ID \\[ \\+ id \\+ \\] to \\[ \\+ newName \\+ \\]","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java","lineNumber":1175,"sourceCode":"      // In case of a root object, the ID is the same as the relative filename...\n      //\n      FileObject fileObject = KettleVFS.getInstance( DefaultBowl.getInstance() )\n        .getFileObject( calcDirectoryName( null ) + id.getId() );\n\n      // Same name, different folder?\n      if ( Utils.isEmpty( newName ) ) {\n        newName = calcObjectName( id );\n      }\n      // The new filename can be anywhere so we re-calculate a new ID...\n      //\n      String newFilename = calcDirectoryName( newDirectory ) + newName + extension;\n\n      FileObject newObject = KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( newFilename );\n      fileObject.moveTo( newObject );\n\n      return new StringObjectId( calcObjectId( newDirectory, newName, extension ) );\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to rename object with ID [\" + id + \"] to [\" + newName + \"]\", e );\n    }\n\n  }\n\n  private String calcObjectName( ObjectId id ) {\n    int slashIndex = id.getId().lastIndexOf( '/' );\n    int dotIndex = id.getId().lastIndexOf( '.' );\n\n    return id.getId().substring( slashIndex + 1, dotIndex );\n  }\n\n  @Override\n  public ObjectId renameJob( ObjectId id_job, RepositoryDirectoryInterface newDir, String newName )\n    throws KettleException {\n    return renameJob( id_job, null, newDir, newName );\n  }\n\n  @Override","sourceCodeStart":1157,"sourceCodeEnd":1193,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java#L1157-L1193","documentation":"KettleFileRepository.renameRepositoryObject() throws this KettleException when the underlying file move fails during a rename of a repository object (transformation, job, etc.). It wraps the VFS/IO exception thrown by fileObject.moveTo(newObject).","triggerScenarios":"Calling the rename API with an ObjectId whose file no longer exists, a target name/extension that resolves to an existing file, or a target directory that is not writable.","commonSituations":"Renaming an object that was deleted by another user/process; target name collides with an existing file; read-only repository directory; OS-level file locks (file open elsewhere) blocking the move.","solutions":["Confirm the source file for the ObjectId still exists on disk","Check that no file with the target name already exists in the target directory","Ensure the repository is not opened read-only and the target folder is writable","Close other programs holding locks on the file (common on Windows) and retry"],"exampleFix":"// before\nrepo.renameRepositoryObject(id, newDir, \"report\", \".ktr\"); // fails if 'report.ktr' exists\n// after\nif (repo.getObjectInformation(newId, RepositoryObjectType.TRANSFORMATION) == null) {\n  repo.renameRepositoryObject(id, newDir, \"report\", \".ktr\");\n}","handlingStrategy":"validation","validationCode":"if (!repo.getRepositoryCapabilities().isReadOnly() && repo.exists(id)) {\n  // proceed with rename\n}","typeGuard":null,"tryCatchPattern":"try {\n  ObjectId newId = repo.renameRepositoryObject(id, newDir, newName, ext);\n} catch (KettleException e) {\n  log.error(\"Rename failed for \" + id + \" -> \" + newName, e);\n}","preventionTips":["Check the target name does not already exist before renaming","Ensure the repository is writable","Avoid renaming files that may be locked by other processes"],"tags":["repository","rename","file-system","vfs"],"backgroundTag":"file-write-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"}