{"record":{"id":"8d1ae77331b5f2e9","repo":"pentaho/pentaho-kettle","slug":"file-name-field-0-couldn-t-be-found-in-the-input-stream","errorCode":null,"errorMessage":"File name field [{0}] couldn't be found in the input stream!","messagePattern":"File name field \\[(.+?)\\] couldn't be found in the input stream!","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/textfileoutput/TextFileOutput.java","lineNumber":256,"sourceCode":"    }\n  }\n\n  public String getOutputFileName( Object[] row ) throws KettleException {\n    String filename = null;\n    if ( row == null ) {\n      if ( data.writer != null ) {\n        filename = data.getFileStreamsCollection().getLastFileName( );\n      } else {\n        filename = meta.getFileName();\n        if ( filename == null ) {\n          throw new KettleFileException( BaseMessages.getString( PKG, \"TextFileOutput.Exception.FileNameNotSet\" ) );\n        }\n        filename = buildFilename( environmentSubstitute( filename ), true );\n      }\n    } else {\n      data.fileNameFieldIndex = getInputRowMeta().indexOfValue( meta.getFileNameField() );\n      if ( data.fileNameFieldIndex < 0 ) {\n        throw new KettleStepException( BaseMessages.getString( PKG, \"TextFileOutput.Exception.FileNameFieldNotFound\", meta.getFileNameField() ) );\n      }\n      data.fileNameMeta = getInputRowMeta().getValueMeta( data.fileNameFieldIndex );\n      data.fileName = data.fileNameMeta.getString( row[data.fileNameFieldIndex] );\n\n      if ( data.fileName == null ) {\n        throw new KettleFileException( BaseMessages.getString( PKG, \"TextFileOutput.Exception.FileNameNotSet\" ) );\n      }\n\n      filename = buildFilename( environmentSubstitute( data.fileName ), true );\n    }\n    return filename;\n  }\n\n  public int getFlushInterval(  )  {\n    String flushIntervalStr = getTransMeta().getVariable( \"KETTLE_FILE_OUTPUT_MAX_STREAM_LIFE\" );\n    int flushInterval = 0;\n    if ( flushIntervalStr != null ) {\n      try {","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/textfileoutput/TextFileOutput.java#L238-L274","documentation":"TextFileOutput is configured with 'File name in field?' so the output filename is taken from a field of the incoming row. The step looks up that field by name in the row's ValueMeta and throws KettleStepException when the field name does not exist in the input stream.","triggerScenarios":"The 'filename field' option is enabled but meta.getFileNameField() names a column absent from the row arriving at the step (renamed, removed upstream, or typo).","commonSituations":"Upstream step renamed/deleted the column; user typed the field name manually instead of selecting it; changed field name casing.","solutions":["Set the 'File name field' in the step dialog to an existing field of the incoming stream (use the field dropdown, not free text)","Add or re-add a 'Select values' / upstream step that supplies the filename field with the exact name","Check that no upstream step filters/removes the field from the row layout"],"exampleFix":"// before: fileNameField set to 'myfile' but stream has 'file_path'\nmeta.setFileNameField( \"myfile\" );\n// after\nmeta.setFileNameField( \"file_path\" ); // exact field name present in input row meta","handlingStrategy":"validation","validationCode":"ValueMetaInterface in = transMeta.getPrevStepFields( stepname );\nif ( in.indexOfValue( fileNameField ) < 0 ) throw new KettleException( \"Field '\" + fileNameField + \"' not in input stream\" );","typeGuard":"boolean fileNameFieldExists( RowMetaInterface rowMeta, String field ) { return rowMeta != null && field != null && rowMeta.indexOfValue( field ) >= 0; }","tryCatchPattern":"try { filename = getOutputFileName( row ); } catch ( KettleStepException e ) { logError( e.getMessage() ); putError( getInputRowMeta(), row, 1, e.getMessage(), \"FileNameFieldNotFound\", \"TextFileOutput-01\" ); }","preventionTips":["Pick the filename field from the dropdown instead of typing it","Re-check field names after modifying upstream steps","Use Select values step to pin the field layout before output"],"tags":["kettle","pentaho","textfileoutput","field-lookup"],"backgroundTag":"resource-not-found","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"}