pentaho/pentaho-kettle · error · KettleStepException

SFTPPut.Error.MoveToDestinationFolderIsEmpty

Error message

SFTPPut.Error.MoveToDestinationFolderIsEmpty

What it means

Thrown when the step is configured with after-FTP action 'move' (AFTER_FTPSPUT_MOVE) but the move-to folder value taken from the row is empty. After a successful upload the file must be moved to a target folder, so the destination folder is required. The step raises KettleStepException before performing the move.

Solutions

  1. Populate the move-to folder field for every row, or set a static/variable-based destination folder instead of a field.
  2. Verify the correct field is selected in the 'Move to folder' setting and that it is filled by an upstream step.
  3. If moving is not required, change the after-FTP action (e.g. delete or do nothing) in the step dialog.
  4. Filter out or fix rows where the field is empty before SFTPPut.

Example fix

// before: rows with moveFolder = null reach the step
// after: default it upstream
if (row.getMoveToFolder() == null || row.getMoveToFolder().isEmpty()) {
  row.setMoveToFolder("/archive/default");
}
Defensive patterns

Strategy: validation

Validate before calling

String moveTo = row.getString(moveToFolderIndex);
if (afterFtps == AFTER_FTPSPUT_MOVE && (moveTo == null || moveTo.isEmpty())) {
  throw new IllegalArgumentException("Move-to folder is required when after-FTP action is MOVE");
}

Try / catch

try {
  transform.execute();
} catch (KettleStepException e) {
  if (e.getMessage().contains("MoveToDestinationFolderIsEmpty")) {
    log.error("Populate the move-to folder field or change the after-FTP action");
  } else { throw e; }
}

Prevention

When it happens

Trigger: meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE and getInputRowMeta().getString(r, data.indexOfMoveToFolderFieldName) returns null/empty for the current row.

Common situations: Move-to-folder field configured but the field is null in some rows; forgetting to populate the move-to folder field upstream; picking the wrong field name in the dialog; rows produced by a join lacking that column.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java:194

        if ( !file.exists() ) {
          // We can not find file
          throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceData ) );
        }
        // get stream from file
        inputStream = KettleVFS.getInputStream( file );

        // Destination filename
        destinationFilename = file.getName().getBaseName();
      }

      if ( file != null ) {
        if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) {
          String realDestationFolder = getInputRowMeta().getString( r, data.indexOfMoveToFolderFieldName );

          if ( Utils.isEmpty( realDestationFolder ) ) {
            // Move to destination folder is empty
            throw new KettleStepException( BaseMessages.getString(
              PKG, "SFTPPut.Error.MoveToDestinationFolderIsEmpty" ) );
          }

          destinationFolder = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( realDestationFolder );

          if ( !destinationFolder.exists() ) {
            // We can not find folder
            throw new KettleStepException( BaseMessages.getString(
              PKG, "SFTPPut.Error.CanNotFindFolder", realDestationFolder ) );
          }
        }
      }

      // move to spool dir ...
      setSFTPDirectory( getInputRowMeta().getString( r, data.indexOfRemoteDirectory ) );

      // Upload a stream
      data.sftpclient.put( inputStream, destinationFilename );

View on GitHub (pinned to f3058517a1)