pentaho/pentaho-kettle · error · KettleStepException
File name field [ ] couldn't be found in the input stream!
Error message
File name field [{0}] couldn't be found in the input stream! What it means
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.
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
Example fix
// before: fileNameField set to 'myfile' but stream has 'file_path' meta.setFileNameField( "myfile" ); // after meta.setFileNameField( "file_path" ); // exact field name present in input row meta
Defensive patterns
Strategy: validation
Validate before calling
ValueMetaInterface in = transMeta.getPrevStepFields( stepname ); if ( in.indexOfValue( fileNameField ) < 0 ) throw new KettleException( "Field '" + fileNameField + "' not in input stream" );
Type guard
boolean fileNameFieldExists( RowMetaInterface rowMeta, String field ) { return rowMeta != null && field != null && rowMeta.indexOfValue( field ) >= 0; } Try / catch
try { filename = getOutputFileName( row ); } catch ( KettleStepException e ) { logError( e.getMessage() ); putError( getInputRowMeta(), row, 1, e.getMessage(), "FileNameFieldNotFound", "TextFileOutput-01" ); } Prevention
- 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
When it happens
Trigger: 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).
Common situations: Upstream step renamed/deleted the column; user typed the field name manually instead of selecting it; changed field name casing.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Error writing field content to file
- Error writing line
- Mail.Exception.CouldnotFindCommentField
- Mail.Exception.CouldnotFindPortField
- Mail.Exception.CouldnotFindSubjectField
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/8d1ae77331b5f2e9.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/textfileoutput/TextFileOutput.java:256
}
}
public String getOutputFileName( Object[] row ) throws KettleException {
String filename = null;
if ( row == null ) {
if ( data.writer != null ) {
filename = data.getFileStreamsCollection().getLastFileName( );
} else {
filename = meta.getFileName();
if ( filename == null ) {
throw new KettleFileException( BaseMessages.getString( PKG, "TextFileOutput.Exception.FileNameNotSet" ) );
}
filename = buildFilename( environmentSubstitute( filename ), true );
}
} else {
data.fileNameFieldIndex = getInputRowMeta().indexOfValue( meta.getFileNameField() );
if ( data.fileNameFieldIndex < 0 ) {
throw new KettleStepException( BaseMessages.getString( PKG, "TextFileOutput.Exception.FileNameFieldNotFound", meta.getFileNameField() ) );
}
data.fileNameMeta = getInputRowMeta().getValueMeta( data.fileNameFieldIndex );
data.fileName = data.fileNameMeta.getString( row[data.fileNameFieldIndex] );
if ( data.fileName == null ) {
throw new KettleFileException( BaseMessages.getString( PKG, "TextFileOutput.Exception.FileNameNotSet" ) );
}
filename = buildFilename( environmentSubstitute( data.fileName ), true );
}
return filename;
}
public int getFlushInterval( ) {
String flushIntervalStr = getTransMeta().getVariable( "KETTLE_FILE_OUTPUT_MAX_STREAM_LIFE" );
int flushInterval = 0;
if ( flushIntervalStr != null ) {
try {View on GitHub (pinned to f3058517a1)