{"record":{"id":"c09e9909867d43eb","repo":"pentaho/pentaho-kettle","slug":"purrepository-error-0006-unable-to-rename-job","errorCode":"PurRepository.ERROR_0006_UNABLE_TO_RENAME_JOB","errorMessage":"Unable to rename Job from \"{0}\" to \"{1}\". Job with name \"{1}\" already exists.","messagePattern":"Unable to rename Job from \"(.+?)\" to \"(.+?)\"\\. Job with name \"(.+?)\" already exists\\.","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":2129,"sourceCode":"      // get file from destination path, should be null for rename goal\n      fileFromDestination = pur.getFile( absPath );\n\n      if ( fileFromDestination == null ) {\n        file = builder.build();\n        NodeRepositoryFileData data;\n        data = pur.getDataAtVersionForRead( file.getId(), null, NodeRepositoryFileData.class );\n\n        if ( newTitle != null ) {\n          // update file's content only if the title should be changed\n          // as this action creates another revision\n          pur.updateFile( file, data, versionComment );\n        }\n        pur.moveFile( idObject.getId(), absPath, null );\n\n        rootRef.clearRef();\n        return idObject;\n      } else {\n        throw new KettleException( BaseMessages.getString( PKG, errorMsgKey, file.getName(), newTitle ) );\n      }\n    } finally {\n      readWriteLock.writeLock().unlock();\n    }\n  }\n\n  protected String getParentPath( final String path ) {\n    if ( path == null ) {\n      throw new IllegalArgumentException();\n    } else if ( RepositoryFile.SEPARATOR.equals( path ) ) {\n      return null;\n    }\n    int lastSlashIndex = path.lastIndexOf( RepositoryFile.SEPARATOR );\n    if ( lastSlashIndex == 0 ) {\n      return RepositoryFile.SEPARATOR;\n    } else if ( lastSlashIndex > 0 ) {\n      return path.substring( 0, lastSlashIndex );\n    } else {","sourceCodeStart":2111,"sourceCodeEnd":2147,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L2111-L2147","documentation":"Thrown by PurRepository.renameJob when the target name for a Job already exists in the Pentaho repository. The repository requires unique file names within a directory, so the rename via pur.moveFile is refused and a KettleException is raised with the ERROR_0006_UNABLE_TO_RENAME_JOB key.","triggerScenarios":"Calling PurRepository.renameJob(jobMetadata, name, directory, comments) with a newTitle that matches another Job in the same target folder; the code checks existence and throws from the else branch instead of moving the file.","commonSituations":"Users renaming a job in Spoon/Pentaho Repository Explorer to a name that already exists; bulk renaming scripts that don't de-duplicate names; re-running an import after a partial rename.","solutions":["Choose a unique target name for the Job in the destination folder","List existing repository objects first and skip or suffix duplicates","Catch the KettleException and surface the name collision to the user instead of failing the batch"],"exampleFix":"// before\nrepository.renameJob(jobMeta, \"load_data\", targetDir, \"rename\");\n// after\nif (repository.exists(nameAbstractJob, targetDir)) {\n  throw new KettleException(\"Name load_data already exists in \" + targetDir);\n}\nrepository.renameJob(jobMeta, \"load_data\", targetDir, \"rename\");","handlingStrategy":"validation","validationCode":"if (repository.exists(nameAbstractJob, targetDir)) {\n  throw new IllegalArgumentException(\"Job name already taken in \" + targetDir);\n}","typeGuard":null,"tryCatchPattern":"try {\n  repository.renameJob(jobMeta, newName, dir, comments);\n} catch (KettleException e) {\n  if (String.valueOf(e.getMessage()).contains(\"already exists\")) {\n    // pick a different name or skip\n  }\n}","preventionTips":["Check repository.exists() before renaming","De-duplicate names in batch rename scripts","Include timestamps in generated names"],"tags":["pentaho","kettle","repository","name-conflict"],"backgroundTag":"file-already-exists","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"}