pentaho/pentaho-kettle · error · KettleException

CreditCardValidator.Exception.CouldnotFindField

CreditCardValidator.Exception.CouldnotFindField

Error message

CreditCardValidator.Exception.CouldnotFindField

What it means

After locating the configured input field name, the step looks it up in the incoming row's metadata via indexOfValue. If the field name is configured but does not exist in the input stream, the step throws KettleException with CouldnotFindField naming the missing field.

Solutions

  1. Fix the configured field name to match an actual input field (mind case)
  2. Add/repair the upstream step that should produce the field
  3. Use a 'Select values' step to rename the field before this step

Example fix

// before
meta.setDynamicField("CardNumber"); // not in stream
// after
meta.setDynamicField("cardNumber"); // matches upstream field name
Defensive patterns

Strategy: validation

Validate before calling

String configured = meta.getDynamicField();
if (!inputRowMeta.getFieldNames().stream().anyMatch(configured::equals)) throw new IllegalArgumentException("Field not in stream: " + configured);

Try / catch

try { trans.execute(...); } catch (KettleException e) { if (e.getMessage().contains("CouldnotFindField")) { logError("Fix the configured field name"); } }

Prevention

When it happens

Trigger: processRow reaches indexOfValue(meta.getDynamicField()) and returns -1 because no input field matches the configured name.

Common situations: Upstream step renamed or dropped the field; case-sensitivity mismatch between configured name and actual field; running the transformation after changing a Select values step; field only produced conditionally upstream.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at plugins/credit-card-validator/impl/src/main/java/org/pentaho/di/trans/steps/creditcardvalidator/CreditCardValidator.java:88

      // get the RowMeta
      data.previousRowMeta = getInputRowMeta().clone();
      data.NrPrevFields = data.previousRowMeta.size();
      data.outputRowMeta = data.previousRowMeta;
      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
        metaStore );

      // Check if field is provided
      if ( Utils.isEmpty( meta.getDynamicField() ) ) {
        logError( BaseMessages.getString( PKG, "CreditCardValidator.Error.CardFieldMissing" ) );
        throw new KettleException( BaseMessages.getString( PKG, "CreditCardValidator.Error.CardFieldMissing" ) );
      }

      // cache the position of the field
      if ( data.indexOfField < 0 ) {
        data.indexOfField = getInputRowMeta().indexOfValue( meta.getDynamicField() );
        if ( data.indexOfField < 0 ) {
          // The field is unreachable !
          throw new KettleException( BaseMessages.getString(
            PKG, "CreditCardValidator.Exception.CouldnotFindField", meta.getDynamicField() ) );
        }
      }
      data.realResultFieldname = environmentSubstitute( meta.getResultFieldName() );
      if ( Utils.isEmpty( data.realResultFieldname ) ) {
        throw new KettleException( BaseMessages
          .getString( PKG, "CreditCardValidator.Exception.ResultFieldMissing" ) );
      }
      data.realCardTypeFieldname = environmentSubstitute( meta.getCardType() );
      data.realNotValidMsgFieldname = environmentSubstitute( meta.getNotValidMsg() );

    } // End If first

    Object[] outputRow = RowDataUtil.allocateRowData( data.outputRowMeta.size() );
    for ( int i = 0; i < data.NrPrevFields; i++ ) {
      outputRow[i] = r[i];
    }
    try {

View on GitHub (pinned to f3058517a1)