pentaho/pentaho-kettle · error · KettleException

LoadFileInput.Exception.CouldnotFindField

LoadFileInput.Exception.CouldnotFindField

Error message

LoadFileInput.Exception.CouldnotFindField

What it means

LoadFileInput.openNextFile throws this when the configured dynamic filename field is not present in the incoming row metadata (indexOfValue returns -1). The field name in the step configuration doesn't match any field produced by the previous step.

Solutions

  1. Preview the previous step and confirm the exact field name (case-sensitive).
  2. Update the 'filename field' in Load File Input to match.
  3. Re-run 'Get Fields' on the upstream step and reselect.
  4. Verify the correct step feeds Load File Input.

Example fix

// before
// dynamicFilenameField = "file"
// upstream field: "file"
// after: upstream emits "file_path" ->
// dynamicFilenameField = "file_path"
Defensive patterns

Strategy: validation

Validate before calling

RowMetaInterface in = transMeta.getPrevStepFields(lfStep);
if (in.indexOfValue(meta.getDynamicFilenameField()) < 0) {
  throw new IllegalStateException("Filename field missing upstream: " + meta.getDynamicFilenameField());
}

Try / catch

try {
  trans.execute(null);
} catch (KettleException e) {
  if (e.getMessage().contains("CouldnotFindField")) {
    log.error("Filename field not found in input rows; re-check upstream fields");
  }
}

Prevention

When it happens

Trigger: meta.getDynamicFilenameField() is set but data.inputRowMeta.indexOfValue(field) < 0 when the first row arrives and openNextFile caches the field index.

Common situations: Field renamed upstream; case-sensitivity mismatch; wrong input hop; transformation edited so the field is no longer emitted.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/loadfileinput/LoadFileInput.java:110

          // Create convert meta-data objects that will contain Date & Number formatters
          // All non binary content is handled as a String. It would be converted to the target type after the processing.
          data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );

          if ( meta.getFileInFields() ) {
            // Check is filename field is provided
            if ( Utils.isEmpty( meta.getDynamicFilenameField() ) ) {
              logError( BaseMessages.getString( PKG, "LoadFileInput.Log.NoField" ) );
              throw new KettleException( BaseMessages.getString( PKG, "LoadFileInput.Log.NoField" ) );
            }

            // cache the position of the field
            if ( data.indexOfFilenameField < 0 ) {
              data.indexOfFilenameField = data.inputRowMeta.indexOfValue( meta.getDynamicFilenameField() );
              if ( data.indexOfFilenameField < 0 ) {
                // The field is unreachable !
                logError( BaseMessages.getString( PKG, "LoadFileInput.Log.ErrorFindingField" )
                  + "[" + meta.getDynamicFilenameField() + "]" );
                throw new KettleException( BaseMessages.getString(
                  PKG, "LoadFileInput.Exception.CouldnotFindField", meta.getDynamicFilenameField() ) );
              }
            }
            // Get the number of previous fields
            data.totalpreviousfields = data.inputRowMeta.size();

          }
        } // end if first

        // get field value
        String fieldvalue = data.inputRowMeta.getString( data.readrow, data.indexOfFilenameField );

        if ( isDetailed() ) {
          logDetailed( BaseMessages.getString(
            PKG, "LoadFileInput.Log.Stream", meta.getDynamicFilenameField(), fieldvalue ) );
        }

        try {

View on GitHub (pinned to f3058517a1)