{"record":{"id":"2756c1ed67f8741d","repo":"pentaho/pentaho-kettle","slug":"s3csvinput-exception-filenamefieldnotfound","errorCode":"S3CsvInput.Exception.FilenameFieldNotFound","errorMessage":"S3CsvInput.Exception.FilenameFieldNotFound","messagePattern":"S3CsvInput\\.Exception\\.FilenameFieldNotFound","errorType":"error_code","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInput.java","lineNumber":206,"sourceCode":"    }\n  }\n\n  private void getFilenamesFromPreviousSteps() throws KettleException {\n    List<String> filenames = new ArrayList<String>();\n    boolean firstRow = true;\n    int index = -1;\n    Object[] row = getRow();\n    while ( row != null ) {\n\n      if ( firstRow ) {\n        firstRow = false;\n\n        // Get the filename field index...\n        //\n        String filenameField = environmentSubstitute( meta.getFilenameField() );\n        index = getInputRowMeta().indexOfValue( filenameField );\n        if ( index < 0 ) {\n          throw new KettleException( Messages.getString( \"S3CsvInput.Exception.FilenameFieldNotFound\", filenameField ) );\n        }\n      }\n\n      String filename = getInputRowMeta().getString( row, index );\n      filenames.add( filename );  // add it to the list...\n\n      row = getRow(); // Grab another row...\n    }\n\n    data.filenames = filenames.toArray( new String[filenames.size()] );\n\n    logBasic( Messages.getString( \"S3CsvInput.Log.ReadingFromNrFiles\", Integer.toString( data.filenames.length ) ) );\n  }\n\n  private boolean openNextFile() throws KettleException {\n    try {\n\n      // Close the previous file...","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInput.java#L188-L224","documentation":"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.","triggerScenarios":"'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.","commonSituations":"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.","solutions":["Open the step dialog and select the filename field from the dropdown so it exactly matches an upstream column","Use 'Preview' on the previous step to confirm the field name and metadata","Check environment variable substitution (e.g. ${FIELD}) resolves to the intended name at runtime","Ensure the upstream step is not running in a mode where it drops the field"],"exampleFix":"// before\nfilenameField = ${INPUT_FILE_COL}  // resolves to 'file_col'\n// after\nfilenameField = filename           // exact upstream column name","handlingStrategy":"validation","validationCode":"RowMetaInterface in = getInputRowMeta();\nString field = environmentSubstitute( meta.getFilenameField() );\nif ( in == null || in.indexOfValue( field ) < 0 ) {\n  throw new IllegalStateException( \"filename field not in row: \" + field );\n}","typeGuard":null,"tryCatchPattern":"try {\n  getFilenamesFromPreviousSteps();\n} catch ( KettleException e ) {\n  logError( \"Check the 'filename field' setting matches an upstream column: \" + e.getMessage() );\n  throw e;\n}","preventionTips":["Select the filename field from the dialog dropdown, never type it freehand","Preview the previous step to confirm field names","Keep variable names for fields stable across environments","Re-check step config after upstream schema changes"],"tags":["kettle","csv","s3","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"}