{"record":{"id":"7b975d3632e93e3f","repo":"pentaho/pentaho-kettle","slug":"field-fieldname-couldn-t-be-found-in-the-input-stream","errorCode":null,"errorMessage":"Field [{fieldName}] couldn't be found in the input stream!","messagePattern":"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":82,"sourceCode":"      TextFileOutputMeta.fileCompressionTypeCodes[TextFileOutputMeta.FILE_COMPRESSION_TYPE_NONE];\n  private static final boolean COMPATIBILITY_APPEND_NO_HEADER = \"Y\".equals(\n          Const.NVL( System.getProperty( Const.KETTLE_COMPATIBILITY_TEXT_FILE_OUTPUT_APPEND_NO_HEADER ), \"N\" ) );\n\n  public TextFileOutputMeta meta;\n\n  public TextFileOutputData data;\n\n  public TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,\n      Trans trans ) {\n    super( stepMeta, stepDataInterface, copyNr, transMeta, trans );\n  }\n\n  private void initFieldNumbers( RowMetaInterface outputRowMeta, TextFileField[] outputFields ) throws KettleException {\n    data.fieldnrs = new int[outputFields.length];\n    for ( int i = 0; i < outputFields.length; i++ ) {\n      data.fieldnrs[i] = outputRowMeta.indexOfValue( outputFields[i].getName() );\n      if ( data.fieldnrs[i] < 0 ) {\n        throw new KettleStepException( \"Field [\" + outputFields[i].getName()\n          + \"] couldn't be found in the input stream!\" );\n      }\n    }\n  }\n\n  public boolean isFileExists( String filename ) throws KettleException {\n    try {\n      return getFileObject( filename, getTransMeta() ).exists();\n    } catch ( Exception e ) {\n      throw new KettleException( \"Error opening new file : \" + e.toString() );\n    }\n  }\n\n  private CompressionProvider getCompressionProvider() throws KettleException {\n    String compressionType = Const.NVL( meta.getFileCompression(), FILE_COMPRESSION_TYPE_NONE );\n\n    CompressionProvider compressionProvider = CompressionProviderFactory.getInstance().getCompressionProviderByName( compressionType );\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/textfileoutput/TextFileOutput.java#L64-L100","documentation":"TextFileOutput validates that every field configured in the step's output field mapping exists in the incoming row stream by calling indexOfValue on the row metadata. If a configured field name is not present in the input stream, initFieldNumbers throws this KettleStepException before any rows are written. It protects the step from silently writing null or misaligned columns.","triggerScenarios":"processRow -> initFieldNumbers with an outputFields entry whose getName() has no match (indexOfValue < 0) in outputRowMeta: field renamed upstream, typo in field name, wrong field casing, or a removed/reordered upstream step no longer produces the field.","commonSituations":"Renaming a column in an upstream step without updating the text file output field list; copy-pasting a transformation between environments where upstream schemas differ; typo when manually editing field definitions; Kettle case-sensitive field matching ('Name' vs 'name').","solutions":["Open the TextFileOutput step, use 'Get Fields' to re-import the actual input fields, and fix or remove the missing field","Check the field name spelling and case against the preview of the previous step's output","Verify the upstream step still produces the field (preview the input rows)","Rebuild the field mapping after any upstream schema change"],"exampleFix":"// before\nfields[i].setName( \"CusotmerId\" ); // typo, not in stream\n// after\nfields[i].setName( \"CustomerId\" ); // matches input row metadata exactly","handlingStrategy":"validation","validationCode":"RowMetaInterface inputRowMeta = transMeta.getPrevStepFields( stepName );\nfor ( TextFileField f : outputFields ) {\n  if ( inputRowMeta.indexOfValue( f.getName() ) < 0 ) {\n    throw new IllegalArgumentException( \"Field not in stream: \" + f.getName() );\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  initFieldNumbers( outputRowMeta, outputFields );\n} catch ( KettleStepException e ) {\n  // list actual stream fields to aid diagnosis\n  logError( e.getMessage() + \" Available: \" + String.join( \",\", outputRowMeta.getFieldNames() ), e );\n  setErrors( 1 );\n  return false;\n}","preventionTips":["Always re-run 'Get Fields' in the step dialog after upstream schema changes","Preview the previous step's output to confirm field names before deploying","Treat field names as case-sensitive; standardize naming conventions"],"tags":["field-mapping","schema","transformation","kettle"],"backgroundTag":"schema-validation-failed","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"}