pentaho/pentaho-kettle · error · KettleException

GetFileNames.Exception.CouldnotFindField

Error message

GetFileNames.Exception.CouldnotFindField

What it means

Thrown when the configured dynamic filename field cannot be found in the incoming row's RowMeta (indexOfValue returned -1). The step needs that field's value on each row to resolve file paths. This is a schema mismatch between the step configuration and the actual input stream.

Solutions

  1. Correct the 'filename field' setting to match an actual incoming field name.
  2. Add/rename the field in the upstream step so it produces the expected field.
  3. Use a Fieldname check or Preview rows to inspect the actual input layout before this step.

Example fix

// before
meta.setDynamicFilenameField("file_name"); // stream has "filename"
// after
meta.setDynamicFilenameField("filename");
Defensive patterns

Strategy: validation

Validate before calling

String f = meta.getDynamicFilenameField();
if (f != null && inputRowMeta.indexOfValue(f) < 0) {
  throw new IllegalArgumentException("Field not in stream: " + f);
}

Try / catch

try { step.processRow(); } catch (KettleStepException e) { if (e.getMessage().contains("CouldnotFindField")) { /* fix mapping */ } throw e; }

Prevention

When it happens

Trigger: meta.getDynamicFilenameField() names a field that is absent from data.inputRowMeta during processRow.

Common situations: Upstream step renamed/removed the field; wrong field name typed manually; transformation edited after input structure changed; case-sensitive field name mismatch.

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/4193946f9c2fdb47. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/getfilenames/GetFileNames.java:112

          metaStore );

        // Get total previous fields
        data.totalpreviousfields = data.inputRowMeta.size();

        // Check is filename field is provided
        if ( Utils.isEmpty( meta.getDynamicFilenameField() ) ) {
          logError( BaseMessages.getString( PKG, "GetFileNames.Log.NoField" ) );
          throw new KettleException( BaseMessages.getString( PKG, "GetFileNames.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, "GetFileNames.Log.ErrorFindingField", meta
              .getDynamicFilenameField() ) );
            throw new KettleException( BaseMessages.getString(
              PKG, "GetFileNames.Exception.CouldnotFindField", meta.getDynamicFilenameField() ) );
          }
        }

        // If wildcard field is specified, Check if field exists
        if ( !Utils.isEmpty( meta.getDynamicWildcardField() ) ) {
          if ( data.indexOfWildcardField < 0 ) {
            data.indexOfWildcardField = data.inputRowMeta.indexOfValue( meta.getDynamicWildcardField() );
            if ( data.indexOfWildcardField < 0 ) {
              // The field is unreachable !
              logError( BaseMessages.getString( PKG, "GetFileNames.Log.ErrorFindingField" )
                + "[" + meta.getDynamicWildcardField() + "]" );
              throw new KettleException( BaseMessages.getString(
                PKG, "GetFileNames.Exception.CouldnotFindField", meta.getDynamicWildcardField() ) );
            }
          }
        }
        // If ExcludeWildcard field is specified, Check if field exists

View on GitHub (pinned to f3058517a1)