pentaho/pentaho-kettle · error · KettleException

S3CsvInput.Exception.FilenameFieldNotFound

S3CsvInput.Exception.FilenameFieldNotFound

Error message

S3CsvInput.Exception.FilenameFieldNotFound

What it means

When the S3 CSV Input step reads filenames from a previous step's field, getFilenamesFromPreviousSteps looks up that field's index in the incoming row metadata. If the configured field name is not present in the row, a KettleException with key S3CsvInput.Exception.FilenameFieldNotFound is thrown.

Solutions

  1. Open the step dialog and select the filename field from the dropdown so it exactly matches an upstream column
  2. Use 'Preview' on the previous step to confirm the field name and metadata
  3. Check environment variable substitution (e.g. ${FIELD}) resolves to the intended name at runtime
  4. Ensure the upstream step is not running in a mode where it drops the field

Example fix

// before
filenameField = ${INPUT_FILE_COL}  // resolves to 'file_col'
// after
filenameField = filename           // exact upstream column name
Defensive patterns

Strategy: validation

Validate before calling

RowMetaInterface in = getInputRowMeta();
String field = environmentSubstitute( meta.getFilenameField() );
if ( in == null || in.indexOfValue( field ) < 0 ) {
  throw new IllegalStateException( "filename field not in row: " + field );
}

Try / catch

try {
  getFilenamesFromPreviousSteps();
} catch ( KettleException e ) {
  logError( "Check the 'filename field' setting matches an upstream column: " + e.getMessage() );
  throw e;
}

Prevention

When it happens

Trigger: 'Get filenames from previous step' is enabled and meta.getFilenameField() (after environment substitution) does not match any column in the incoming row stream — indexOfValue returns -1.

Common situations: Renamed or deleted the source field upstream; typo or wrong case in the filename field setting; variable in the field name resolving to an unexpected value; upstream step emitting different metadata on later rows.

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


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/2756c1ed67f8741d. Report an issue: GitHub.

Appendix: source

Thrown at plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInput.java:206

    }
  }

  private void getFilenamesFromPreviousSteps() throws KettleException {
    List<String> filenames = new ArrayList<String>();
    boolean firstRow = true;
    int index = -1;
    Object[] row = getRow();
    while ( row != null ) {

      if ( firstRow ) {
        firstRow = false;

        // Get the filename field index...
        //
        String filenameField = environmentSubstitute( meta.getFilenameField() );
        index = getInputRowMeta().indexOfValue( filenameField );
        if ( index < 0 ) {
          throw new KettleException( Messages.getString( "S3CsvInput.Exception.FilenameFieldNotFound", filenameField ) );
        }
      }

      String filename = getInputRowMeta().getString( row, index );
      filenames.add( filename );  // add it to the list...

      row = getRow(); // Grab another row...
    }

    data.filenames = filenames.toArray( new String[filenames.size()] );

    logBasic( Messages.getString( "S3CsvInput.Log.ReadingFromNrFiles", Integer.toString( data.filenames.length ) ) );
  }

  private boolean openNextFile() throws KettleException {
    try {

      // Close the previous file...

View on GitHub (pinned to f3058517a1)