{"record":{"id":"7e076e2cbb746578","repo":"pentaho/pentaho-kettle","slug":"sftpput-error-movetodestinationfolderisempty","errorCode":null,"errorMessage":"SFTPPut.Error.MoveToDestinationFolderIsEmpty","messagePattern":"SFTPPut\\.Error\\.MoveToDestinationFolderIsEmpty","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java","lineNumber":194,"sourceCode":"\n        if ( !file.exists() ) {\n          // We can not find file\n          throw new KettleStepException( BaseMessages.getString( PKG, \"SFTPPut.Error.CanNotFindField\", sourceData ) );\n        }\n        // get stream from file\n        inputStream = KettleVFS.getInputStream( file );\n\n        // Destination filename\n        destinationFilename = file.getName().getBaseName();\n      }\n\n      if ( file != null ) {\n        if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) {\n          String realDestationFolder = getInputRowMeta().getString( r, data.indexOfMoveToFolderFieldName );\n\n          if ( Utils.isEmpty( realDestationFolder ) ) {\n            // Move to destination folder is empty\n            throw new KettleStepException( BaseMessages.getString(\n              PKG, \"SFTPPut.Error.MoveToDestinationFolderIsEmpty\" ) );\n          }\n\n          destinationFolder = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( realDestationFolder );\n\n          if ( !destinationFolder.exists() ) {\n            // We can not find folder\n            throw new KettleStepException( BaseMessages.getString(\n              PKG, \"SFTPPut.Error.CanNotFindFolder\", realDestationFolder ) );\n          }\n        }\n      }\n\n      // move to spool dir ...\n      setSFTPDirectory( getInputRowMeta().getString( r, data.indexOfRemoteDirectory ) );\n\n      // Upload a stream\n      data.sftpclient.put( inputStream, destinationFilename );","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java#L176-L212","documentation":"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.","triggerScenarios":"meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE and getInputRowMeta().getString(r, data.indexOfMoveToFolderFieldName) returns null/empty for the current row.","commonSituations":"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.","solutions":["Populate the move-to folder field for every row, or set a static/variable-based destination folder instead of a field.","Verify the correct field is selected in the 'Move to folder' setting and that it is filled by an upstream step.","If moving is not required, change the after-FTP action (e.g. delete or do nothing) in the step dialog.","Filter out or fix rows where the field is empty before SFTPPut."],"exampleFix":"// before: rows with moveFolder = null reach the step\n// after: default it upstream\nif (row.getMoveToFolder() == null || row.getMoveToFolder().isEmpty()) {\n  row.setMoveToFolder(\"/archive/default\");\n}","handlingStrategy":"validation","validationCode":"String moveTo = row.getString(moveToFolderIndex);\nif (afterFtps == AFTER_FTPSPUT_MOVE && (moveTo == null || moveTo.isEmpty())) {\n  throw new IllegalArgumentException(\"Move-to folder is required when after-FTP action is MOVE\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  transform.execute();\n} catch (KettleStepException e) {\n  if (e.getMessage().contains(\"MoveToDestinationFolderIsEmpty\")) {\n    log.error(\"Populate the move-to folder field or change the after-FTP action\");\n  } else { throw e; }\n}","preventionTips":["Default the move-to folder upstream (Add constants / set variable).","Choose a non-move after-FTP action if archiving isn't required.","Preview rows to confirm the move-to folder field is populated for all rows."],"tags":["kettle","pentaho","sftp","missing-field","configuration"],"backgroundTag":"missing-required-argument","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"}