{"record":{"id":"02a988fc0b041976","repo":"pentaho/pentaho-kettle","slug":"regexeval-exception-couldnotfindfield","errorCode":null,"errorMessage":"RegexEval.Exception.CouldnotFindField","messagePattern":"RegexEval\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/regexeval/RegexEval.java","lineNumber":108,"sourceCode":"        if ( data.indexOfResultField < 0 ) {\n          data.indexOfResultField = getInputRowMeta().size();\n          captureIndex++;\n        }\n      }\n\n      // Check if a Field (matcher) is given\n      if ( meta.getMatcher() == null ) {\n        // Matcher is missing !\n        logError( BaseMessages.getString( PKG, \"RegexEval.Log.ErrorMatcherMissing\" ) );\n        throw new KettleStepException( BaseMessages.getString( PKG, \"RegexEval.Exception.ErrorMatcherMissing\" ) );\n      }\n\n      // Cache the position of the Field\n      data.indexOfFieldToEvaluate = getInputRowMeta().indexOfValue( meta.getMatcher() );\n      if ( data.indexOfFieldToEvaluate < 0 ) {\n        // The field is unreachable !\n        logError( BaseMessages.getString( PKG, \"RegexEval.Log.ErrorFindingField\" ) + \"[\" + meta.getMatcher() + \"]\" );\n        throw new KettleStepException( BaseMessages.getString( PKG, \"RegexEval.Exception.CouldnotFindField\", meta\n          .getMatcher() ) );\n      }\n\n      // Cache the position of the CaptureGroups\n      if ( meta.isAllowCaptureGroupsFlagSet() ) {\n        data.positions = new int[meta.getFieldName().length];\n        String[] fieldName = meta.getFieldName();\n        for ( int i = 0; i < fieldName.length; i++ ) {\n          if ( fieldName[i] == null || fieldName[i].length() == 0 ) {\n            continue;\n          }\n          if ( meta.isReplacefields() ) {\n            data.positions[i] = data.outputRowMeta.indexOfValue( fieldName[i] );\n          } else {\n            data.positions[i] = captureIndex;\n            captureIndex++;\n          }\n        }","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/regexeval/RegexEval.java#L90-L126","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the field exists in the incoming stream (use Spoon's 'Input fields' preview)","Update the step's matcher field to the correct/renamed field name","Reorder/fix upstream steps so the field is produced before Regex Eval"],"exampleFix":"// before\nmeta.setMatcher(\"oldFieldName\");\n// after\nRowMetaInterface input = transMeta.getPrevStepFields(stepMeta);\nString matcher = \"oldFieldName\";\nif (input.searchValueMeta(matcher) == null) {\n  matcher = input.getFieldNames()[0]; // or fail fast with a clear message\n}\nmeta.setMatcher(matcher);","handlingStrategy":"validation","validationCode":"RowMetaInterface input = transMeta.getPrevStepFields(stepMeta);\nRegexEvalMeta m = (RegexEvalMeta) stepMeta.getStepMetaInterface();\nif (input.searchValueMeta(m.getMatcher()) == null) throw new IllegalArgumentException(\"Matcher field '\" + m.getMatcher() + \"' not found in input stream\");","typeGuard":null,"tryCatchPattern":"try { trans.execute(...); } catch (KettleException e) { if (e.getMessage().contains(\"CouldnotFindField\")) { logError(\"Matcher field missing from input — check upstream steps\"); } throw e; }","preventionTips":["Preview upstream rows to confirm field names before Regex Eval","Update dependent steps whenever renaming fields upstream","Keep field naming consistent (case-sensitive) across steps"],"tags":["kettle","regex","field-resolution","stream"],"backgroundTag":"record-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}