pentaho/pentaho-kettle · error · KettleException

PurRepository.ERROR_0006_UNABLE_TO_RENAME_JOB

PurRepository.ERROR_0006_UNABLE_TO_RENAME_JOB

Error message

Unable to rename Job from "{0}" to "{1}". Job with name "{1}" already exists.

What it means

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.

Solutions

  1. Choose a unique target name for the Job in the destination folder
  2. List existing repository objects first and skip or suffix duplicates
  3. Catch the KettleException and surface the name collision to the user instead of failing the batch

Example fix

// before
repository.renameJob(jobMeta, "load_data", targetDir, "rename");
// after
if (repository.exists(nameAbstractJob, targetDir)) {
  throw new KettleException("Name load_data already exists in " + targetDir);
}
repository.renameJob(jobMeta, "load_data", targetDir, "rename");
Defensive patterns

Strategy: validation

Validate before calling

if (repository.exists(nameAbstractJob, targetDir)) {
  throw new IllegalArgumentException("Job name already taken in " + targetDir);
}

Try / catch

try {
  repository.renameJob(jobMeta, newName, dir, comments);
} catch (KettleException e) {
  if (String.valueOf(e.getMessage()).contains("already exists")) {
    // pick a different name or skip
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/c09e9909867d43eb. Report an issue: GitHub.

Appendix: source

Thrown at plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java:2129

      // get file from destination path, should be null for rename goal
      fileFromDestination = pur.getFile( absPath );

      if ( fileFromDestination == null ) {
        file = builder.build();
        NodeRepositoryFileData data;
        data = pur.getDataAtVersionForRead( file.getId(), null, NodeRepositoryFileData.class );

        if ( newTitle != null ) {
          // update file's content only if the title should be changed
          // as this action creates another revision
          pur.updateFile( file, data, versionComment );
        }
        pur.moveFile( idObject.getId(), absPath, null );

        rootRef.clearRef();
        return idObject;
      } else {
        throw new KettleException( BaseMessages.getString( PKG, errorMsgKey, file.getName(), newTitle ) );
      }
    } finally {
      readWriteLock.writeLock().unlock();
    }
  }

  protected String getParentPath( final String path ) {
    if ( path == null ) {
      throw new IllegalArgumentException();
    } else if ( RepositoryFile.SEPARATOR.equals( path ) ) {
      return null;
    }
    int lastSlashIndex = path.lastIndexOf( RepositoryFile.SEPARATOR );
    if ( lastSlashIndex == 0 ) {
      return RepositoryFile.SEPARATOR;
    } else if ( lastSlashIndex > 0 ) {
      return path.substring( 0, lastSlashIndex );
    } else {

View on GitHub (pinned to f3058517a1)