{"record":{"id":"f5b3821050c2b37c","repo":"pentaho/pentaho-kettle","slug":"stringoperations-exception-fieldrequired","errorCode":null,"errorMessage":"StringOperations.Exception.FieldRequired","messagePattern":"StringOperations\\.Exception\\.FieldRequired","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperations.java","lineNumber":234,"sourceCode":"      setOutputDone();\n      return false;\n    }\n\n    if ( first ) {\n      first = false;\n\n      // What's the format of the output row?\n      data.outputRowMeta = getInputRowMeta().clone();\n      data.inputFieldsNr = data.outputRowMeta.size();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n        metaStore );\n      data.nrFieldsInStream = meta.getFieldInStream().length;\n      data.inStreamNrs = new int[data.nrFieldsInStream];\n      for ( int i = 0; i < meta.getFieldInStream().length; i++ ) {\n        data.inStreamNrs[i] = getInputRowMeta().indexOfValue( meta.getFieldInStream()[i] );\n        if ( data.inStreamNrs[i] < 0 ) { // couldn't find field!\n\n          throw new KettleStepException( BaseMessages.getString( PKG, \"StringOperations.Exception.FieldRequired\", meta\n              .getFieldInStream()[i] ) );\n        }\n        // check field type\n        if ( !getInputRowMeta().getValueMeta( data.inStreamNrs[i] ).isString() ) {\n          throw new KettleStepException( BaseMessages.getString( PKG, \"StringOperations.Exception.FieldTypeNotString\",\n              meta.getFieldInStream()[i] ) );\n        }\n      }\n\n      data.outStreamNrs = new String[data.nrFieldsInStream];\n      for ( int i = 0; i < meta.getFieldInStream().length; i++ ) {\n        data.outStreamNrs[i] = meta.getFieldOutStream()[i];\n      }\n\n      // Keep track of the trim operators locally for a very small\n      // optimization.\n      data.trimOperators = new String[data.nrFieldsInStream];\n      for ( int i = 0; i < meta.getFieldInStream().length; i++ ) {","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/stringoperations/StringOperations.java#L216-L252","documentation":"StringOperations throws this KettleStepException in processRow() when a field configured for a string operation cannot be found in the incoming row. indexOfValue() returned -1 for one of meta.getFieldInStream() entries, so the step cannot locate the value to transform.","triggerScenarios":"On the first processed row when getInputRowMeta().indexOfValue(meta.getFieldInStream()[i]) < 0 — the configured input field name does not exist in the upstream row layout.","commonSituations":"Upstream field renamed or dropped; connecting the step to a different hop than intended; case-sensitive name mismatch; metadata injected at runtime differs from design time.","solutions":["Fix the field name in the String Operations step dialog to match the actual stream field exactly","Restore the field in the upstream step that was renamed/removed","Preview the input stream to confirm available field names and re-map","If fields are dynamic, add a guard (e.g. User Defined Java Expression or filter) before this step"],"exampleFix":"// before\n<field><in_stream_name>emial</in_stream_name><in_stream_trim>...</field>\n// after\n<field><in_stream_name>email</in_stream_name><in_stream_trim>...</field>","handlingStrategy":"validation","validationCode":"// validate field presence before execution\nRowMetaInterface input = transMeta.getPrevStepFields(stepMeta);\nfor (String f : sopMeta.getFieldInStream()) {\n  if (input.indexOfValue(f) < 0) {\n    throw new IllegalStateException(\"Field not found in stream: \" + f);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(null);\n  trans.waitUntilFinished();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"StringOperations.Exception.FieldRequired\")) {\n    // re-map the missing field in the step dialog, then re-run\n  }\n}","preventionTips":["Preview the incoming stream to confirm exact field names","Keep step field mappings in sync when renaming upstream fields","Avoid dynamic field dropping upstream without updating this step","Use case-consistent field naming across the transformation"],"tags":["row-stream","field-lookup","pdi","step-runtime"],"backgroundTag":"resource-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"}