pentaho/pentaho-kettle · error · KettleException

PropertyInput.Exception.CouldnotFindField

Error message

PropertyInput.Exception.CouldnotFindField

What it means

In openNextFile(), when reading filenames from an incoming field, this is thrown if the configured dynamic filename field cannot be found in the input row metadata (indexOfValue returns -1). The field name in the message is the one that could not be located.

Solutions

  1. Fix the 'Filename field' in the step dialog to match the actual incoming column name exactly
  2. Check the upstream step's output fields (row layout) and keep the column name stable
  3. Add a Select Values step to (re)name or restore the field before Property Input
  4. Use 'Preview' on the previous step to confirm the field exists and its exact name

Example fix

// before: field renamed upstream, step still expects old name
meta.setDynamicFilenameField("fname");
// after
meta.setDynamicFilenameField("filename"); // matches upstream Select Values rename
Defensive patterns

Strategy: validation

Validate before calling

RowMetaInterface in = prevStep.getStepMetaInterface().getTableFields(); // or preview row meta
if (in.indexOfValue(meta.getDynamicFilenameField()) < 0) {
  throw new IllegalStateException("Field " + meta.getDynamicFilenameField() + " not in incoming rows");
}

Type guard

boolean fieldPresent = inputRowMeta.indexOfValue(fieldName) >= 0;

Try / catch

try {
  transformation.execute(params);
} catch (KettleException e) {
  if (e.getMessage() != null && e.getMessage().contains("CouldnotFindField")) {
    logError("Filename field not found in input rows; check upstream step");
  } else { throw e; }
}

Prevention

When it happens

Trigger: The step's 'Filename field' names a column that does not exist in the row arriving from the previous step — renamed upstream, wrong case, or the field was removed from the Select/Text File Output upstream.

Common situations: Upstream step renamed or dropped the column; step copied between transformations whose row layouts differ; field name typo or case mismatch (e.g. 'FileName' vs 'filename').

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/867b5c630bdcb98b. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/propertyinput/PropertyInput.java:362

          data.totalpreviousfields = data.inputRowMeta.size();

          // Create convert meta-data objects that will contain Date & Number formatters
          data.convertRowMeta = data.outputRowMeta.cloneToType( ValueMetaInterface.TYPE_STRING );

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

          // cache the position of the field
          if ( data.indexOfFilenameField < 0 ) {
            data.indexOfFilenameField = getInputRowMeta().indexOfValue( meta.getDynamicFilenameField() );
            if ( data.indexOfFilenameField < 0 ) {
              // The field is unreachable !
              logError( BaseMessages.getString( PKG, "PropertyInput.Log.ErrorFindingField" )
                + '[' + meta.getDynamicFilenameField() + ']' );
              throw new KettleException( BaseMessages.getString(
                PKG, "PropertyInput.Exception.CouldnotFindField", meta.getDynamicFilenameField() ) );
            }
          }
        } // End if first

        String filename = getInputRowMeta().getString( data.readrow, data.indexOfFilenameField );
        if ( log.isDetailed() ) {
          logDetailed( BaseMessages.getString( PKG, "PropertyInput.Log.FilenameInStream", meta
            .getDynamicFilenameField(), filename ) );
        }

        data.file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( filename, getTransMeta() );
        // Check if file exists!
      }

      data.filename = KettleVFS.getFilename( data.file );

      // Add additional fields?

View on GitHub (pinned to f3058517a1)