pentaho/pentaho-kettle · error · KettleStepException

RegexEval.Exception.CouldnotFindField

Error message

RegexEval.Exception.CouldnotFindField

What it means

RegexEval.processRow throws KettleStepException when the configured matcher field cannot be found in the incoming row metadata (indexOfValue returned -1). The field the regex should evaluate does not exist on the stream at runtime.

Solutions

  1. Verify the field exists in the incoming stream (use Spoon's 'Input fields' preview)
  2. Update the step's matcher field to the correct/renamed field name
  3. Reorder/fix upstream steps so the field is produced before Regex Eval

Example fix

// before
meta.setMatcher("oldFieldName");
// after
RowMetaInterface input = transMeta.getPrevStepFields(stepMeta);
String matcher = "oldFieldName";
if (input.searchValueMeta(matcher) == null) {
  matcher = input.getFieldNames()[0]; // or fail fast with a clear message
}
meta.setMatcher(matcher);
Defensive patterns

Strategy: validation

Validate before calling

RowMetaInterface input = transMeta.getPrevStepFields(stepMeta);
RegexEvalMeta m = (RegexEvalMeta) stepMeta.getStepMetaInterface();
if (input.searchValueMeta(m.getMatcher()) == null) throw new IllegalArgumentException("Matcher field '" + m.getMatcher() + "' not found in input stream");

Try / catch

try { trans.execute(...); } catch (KettleException e) { if (e.getMessage().contains("CouldnotFindField")) { logError("Matcher field missing from input — check upstream steps"); } throw e; }

Prevention

When it happens

Trigger: The matcher field name configured in the step doesn't match any field of the input row — upstream field renamed, removed, or the step's input changed; detected per row before regex matching.

Common situations: Renaming an upstream Select Values / Text File Input field and forgetting the Regex Eval step; plugging the step into a different stream than designed; case-sensitivity mismatch between configured and actual field names.

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/02a988fc0b041976. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/regexeval/RegexEval.java:108

        if ( data.indexOfResultField < 0 ) {
          data.indexOfResultField = getInputRowMeta().size();
          captureIndex++;
        }
      }

      // Check if a Field (matcher) is given
      if ( meta.getMatcher() == null ) {
        // Matcher is missing !
        logError( BaseMessages.getString( PKG, "RegexEval.Log.ErrorMatcherMissing" ) );
        throw new KettleStepException( BaseMessages.getString( PKG, "RegexEval.Exception.ErrorMatcherMissing" ) );
      }

      // Cache the position of the Field
      data.indexOfFieldToEvaluate = getInputRowMeta().indexOfValue( meta.getMatcher() );
      if ( data.indexOfFieldToEvaluate < 0 ) {
        // The field is unreachable !
        logError( BaseMessages.getString( PKG, "RegexEval.Log.ErrorFindingField" ) + "[" + meta.getMatcher() + "]" );
        throw new KettleStepException( BaseMessages.getString( PKG, "RegexEval.Exception.CouldnotFindField", meta
          .getMatcher() ) );
      }

      // Cache the position of the CaptureGroups
      if ( meta.isAllowCaptureGroupsFlagSet() ) {
        data.positions = new int[meta.getFieldName().length];
        String[] fieldName = meta.getFieldName();
        for ( int i = 0; i < fieldName.length; i++ ) {
          if ( fieldName[i] == null || fieldName[i].length() == 0 ) {
            continue;
          }
          if ( meta.isReplacefields() ) {
            data.positions[i] = data.outputRowMeta.indexOfValue( fieldName[i] );
          } else {
            data.positions[i] = captureIndex;
            captureIndex++;
          }
        }

View on GitHub (pinned to f3058517a1)