{"record":{"id":"b44a497443a2019c","repo":"pentaho/pentaho-kettle","slug":"processfiles-error-sourcefilenamefieldmissing","errorCode":null,"errorMessage":"ProcessFiles.Error.SourceFilenameFieldMissing","messagePattern":"ProcessFiles\\.Error\\.SourceFilenameFieldMissing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/processfiles/ProcessFiles.java","lineNumber":67,"sourceCode":"    Trans trans ) {\n    super( stepMeta, stepDataInterface, copyNr, transMeta, trans );\n  }\n\n  public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException {\n    meta = (ProcessFilesMeta) smi;\n    data = (ProcessFilesData) sdi;\n\n    Object[] r = getRow(); // Get row from input rowset & set row busy!\n    if ( r == null ) { // no more input to be expected...\n\n      setOutputDone();\n      return false;\n    }\n    if ( first ) {\n      first = false;\n      // Check is source filename field is provided\n      if ( Utils.isEmpty( meta.getDynamicSourceFileNameField() ) ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"ProcessFiles.Error.SourceFilenameFieldMissing\" ) );\n      }\n      // Check is target filename field is provided\n      if ( meta.getOperationType() != ProcessFilesMeta.OPERATION_TYPE_DELETE\n        && Utils.isEmpty( meta.getDynamicTargetFileNameField() ) ) {\n        throw new KettleException( BaseMessages.getString( PKG, \"ProcessFiles.Error.TargetFilenameFieldMissing\" ) );\n      }\n\n      // cache the position of the source filename field\n      if ( data.indexOfSourceFilename < 0 ) {\n        data.indexOfSourceFilename = getInputRowMeta().indexOfValue( meta.getDynamicSourceFileNameField() );\n        if ( data.indexOfSourceFilename < 0 ) {\n          // The field is unreachable !\n          throw new KettleException( BaseMessages.getString( PKG, \"ProcessFiles.Exception.CouldnotFindField\", meta\n            .getDynamicSourceFileNameField() ) );\n        }\n      }\n      // cache the position of the source filename field\n      if ( meta.getOperationType() != ProcessFilesMeta.OPERATION_TYPE_DELETE && data.indexOfTargetFilename < 0 ) {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/processfiles/ProcessFiles.java#L49-L85","documentation":"KettleException thrown by ProcessFiles.processRow on the first row when the 'source filename field' setting is empty. ProcessFiles copies/moves/deletes files named dynamically by fields in the incoming stream, so it requires the name of the field that holds the source file path; if the setting is missing the step cannot run. The check is Utils.isEmpty(meta.getDynamicSourceFileNameField()).","triggerScenarios":"The transformation runs the Process Files step with the 'Source filename fieldname' left blank in the step dialog, regardless of operation type.","commonSituations":"Step configured through metadata API or hand-edited ktr where the field was never set; importing an old transformation where the setting was lost.","solutions":["Open the Process Files step dialog and set 'Source filename fieldname' to an existing input field.","If building metadata programmatically, call meta.setDynamicSourceFileNameField(\"source_filename\") before adding the step.","Re-save the transformation after fixing and verify the field exists in the incoming stream."],"exampleFix":"// before\nProcessFilesMeta meta = new ProcessFilesMeta();\nmeta.setOperationType(ProcessFilesMeta.OPERATION_TYPE_COPY);\n// after\nProcessFilesMeta meta = new ProcessFilesMeta();\nmeta.setDynamicSourceFileNameField(\"source_file\");\nmeta.setDynamicTargetFileNameField(\"target_file\");\nmeta.setOperationType(ProcessFilesMeta.OPERATION_TYPE_COPY);","handlingStrategy":"validation","validationCode":"// Before executing, ensure the meta is complete\nif (meta.getDynamicSourceFileNameField() == null || meta.getDynamicSourceFileNameField().isEmpty()) {\n  throw new IllegalArgumentException(\"Process Files: source filename field must be set\");\n}","typeGuard":null,"tryCatchPattern":"try { trans.execute(null); } catch (KettleException e) { if (e.getMessage().contains(\"SourceFilenameFieldMissing\")) { log.error(\"Set 'Source filename fieldname' in Process Files step\", e); } throw e; }","preventionTips":["Always fill both filename fields in the step dialog","Use Spoon's step validation before saving","Check meta completeness in CI when generating transformations programmatically"],"tags":["kettle","configuration","file-processing"],"backgroundTag":"missing-required-config-field","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"}