pentaho/pentaho-kettle · error · KettleObjectExistsException

Failed to save object to repository. Object

Error message

Failed to save object to repository. Object [{0}] already exists.

What it means

saveSlaveServer throws KettleObjectExistsException when a slave server with the same name already exists in the repository and overwrite=false. The delegate will not replace the existing R_SLAVE row unless the caller explicitly allows overwriting.

Solutions

  1. Pass overwrite=true to replace the existing slave server definition
  2. Rename the slave server to a unique name
  3. Look up the existing slave first and update its properties instead of creating a duplicate
  4. Catch KettleObjectExistsException and prompt the user whether to overwrite

Example fix

// before
ObjectId id = delegate.saveSlaveServer(slave, false);
// after
ObjectId id;
try {
  id = delegate.saveSlaveServer(slave, false);
} catch (KettleObjectExistsException e) {
  id = delegate.saveSlaveServer(slave, true);
}
Defensive patterns

Strategy: try-catch

Validate before calling

ObjectId existing = delegate.getSlaveID(slave.getName());
boolean willCollide = existing != null && !existing.equals(slave.getObjectId());

Try / catch

try { delegate.saveSlaveServer(slave, false); } catch (KettleObjectExistsException e) { delegate.saveSlaveServer(slave, true); }

Prevention

When it happens

Trigger: Calling saveSlaveServer(slaveServer, overwrite=false) when getSlaveID(name) finds an existing slave row with the same name (and it is not the same object).

Common situations: Importing cluster definitions that collide with existing slave names; renaming clusters in one environment then importing into another; re-running setup scripts without overwrite.

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/05fd41008f3a4632. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositorySlaveServerDelegate.java:87

      // See if the slave doesn't exist already (just for safety and PDI-5102
      //
      slaveServer.setObjectId( getSlaveID( slaveServer.getName() ) );
    }

    if ( slaveServer.getObjectId() == null ) {
      // New Slave Server
      slaveServer.setObjectId( insertSlave( slaveServer ) );
    } else {
      ObjectId existingSlaveId = slaveServer.getObjectId();
      if ( existingSlaveId != null
        && slaveServer.getObjectId() != null && !slaveServer.getObjectId().equals( existingSlaveId ) ) {
        // A slave with this name already exists
        if ( overwrite ) {
          // Proceed with save, removing the original version from the repository first
          repository.deleteSlave( existingSlaveId );
          updateSlave( slaveServer );
        } else {
          throw new KettleObjectExistsException( "Failed to save object to repository. Object ["
            + slaveServer.getName() + "] already exists." );
        }
      } else {
        // There are no naming collisions (either it is the same object or the name is unique)
        updateSlave( slaveServer );
      }
    }

    // Save the trans-slave relationship too.
    if ( id_transformation != null && isUsedByTransformation ) {
      repository.insertTransformationSlave( id_transformation, slaveServer.getObjectId() );
    }
  }

  public SlaveServer loadSlaveServer( ObjectId id_slave_server ) throws KettleException {
    SlaveServer slaveServer = new SlaveServer();

    slaveServer.setObjectId( id_slave_server );

View on GitHub (pinned to f3058517a1)