{"record":{"id":"8a7e6c64f1539b33","repo":"pentaho/pentaho-kettle","slug":"sftpput-error-remotefilenamefieldmissing","errorCode":null,"errorMessage":"SFTPPut.Error.RemoteFilenameFieldMissing","messagePattern":"SFTPPut\\.Error\\.RemoteFilenameFieldMissing","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java","lineNumber":169,"sourceCode":"    InputStream inputStream = null;\n    FileObject destinationFolder = null;\n    String destinationFilename;\n    FileObject file = null;\n\n    try {\n      if ( Utils.isEmpty( sourceData ) ) {\n        // Source data is empty\n        throw new KettleStepException( BaseMessages.getString( PKG, \"SFTPPut.Error.SourceDataEmpty\" ) );\n      }\n\n      if ( meta.isInputStream() ) {\n        // Source data is a stream\n        inputStream = new ByteArrayInputStream( getInputRowMeta().getBinary( r, data.indexOfSourceFileFieldName ) );\n\n        if ( data.indexOfRemoteFilename == -1 ) {\n          // for the case when put data is transferred via input field\n          // it is mandatory to specify remote file name\n          throw new KettleStepException( BaseMessages.getString( PKG, \"SFTPPut.Error.RemoteFilenameFieldMissing\" ) );\n        }\n        destinationFilename = getInputRowMeta().getString( r, data.indexOfRemoteFilename );\n      } else {\n        // source data is a file\n        // let's check file\n        file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( sourceData );\n\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","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/sftpput/impl/src/main/java/org/pentaho/di/trans/steps/sftpput/SFTPPut.java#L151-L187","documentation":"Thrown when the SFTPPut step is configured to read source data from an input stream (meta.isInputStream() is true) but no remote filename field is configured or resolvable (data.indexOfRemoteFilename == -1). In stream mode the destination filename cannot be derived from a file name, so an explicit remote filename field is mandatory. The step fails fast with KettleStepException before attempting the upload.","triggerScenarios":"Input stream mode is enabled and the 'remote filename' field is not specified in the dialog, or the specified field is absent from the row layout so its index resolves to -1.","commonSituations":"Switching the step from file mode to stream mode without also setting the remote filename field; renaming the remote filename field upstream; getting fields from the wrong previous step so the field never appears in the row meta.","solutions":["Open the SFTPPut step dialog and set the remote filename field while in input-stream mode.","Verify the configured remote filename field actually exists in the incoming stream (use 'Get Fields').","If a file-based upload is intended, disable the input stream option so the destination name defaults to the file's base name.","Fix upstream steps so the remote filename field is present and named identically."],"exampleFix":"// before (dialog/config): stream mode with no remote filename field\nsource = inputStream; remoteFilenameField = null;\n// after\nsource = inputStream; remoteFilenameField = \"remote_target_name\";","handlingStrategy":"validation","validationCode":"// before running, verify stream mode has a remote filename field present\nString[] fields = rowMeta.getFieldNames();\nif (isStreamMode && (remoteFilenameField == null || !Arrays.asList(fields).contains(remoteFilenameField))) {\n  throw new IllegalStateException(\"input-stream mode requires an existing remote filename field\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  transform.execute();\n} catch (KettleStepException e) {\n  if (e.getMessage().contains(\"RemoteFilenameFieldMissing\")) {\n    log.error(\"Set the remote filename field in SFTPPut dialog when using input stream mode\");\n  } else { throw e; }\n}","preventionTips":["Whenever enabling input-stream mode, immediately configure the remote filename field.","Run field preview/Get Fields after changing upstream steps.","Avoid renaming fields without checking downstream steps using them."],"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"}