{"record":{"id":"40cc35d786ad9490","repo":"pentaho/pentaho-kettle","slug":"stringcut-exception-fieldrequired","errorCode":null,"errorMessage":"StringCut.Exception.FieldRequired","messagePattern":"StringCut\\.Exception\\.FieldRequired","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCut.java","lineNumber":133,"sourceCode":"    if ( r == null ) { // no more input to be expected...\n\n      setOutputDone();\n      return false;\n    }\n\n    if ( first ) {\n      first = false;\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\n      data.inStreamNrs = new int[meta.getFieldInStream().length];\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 ) {\n          throw new KettleStepException( BaseMessages.getString( PKG, \"StringCut.Exception.FieldRequired\", meta\n            .getFieldInStream()[i] ) );\n        }\n\n        // check field type\n        if ( getInputRowMeta().getValueMeta( data.inStreamNrs[i] ).getType() != ValueMetaInterface.TYPE_STRING ) {\n          throw new KettleStepException( BaseMessages.getString(\n            PKG, \"StringCut.Exception.FieldTypeNotString\", meta.getFieldInStream()[i] ) );\n        }\n      }\n\n      data.outStreamNrs = new String[meta.getFieldInStream().length];\n      for ( int i = 0; i < meta.getFieldInStream().length; i++ ) {\n        data.outStreamNrs[i] = environmentSubstitute( meta.getFieldOutStream()[i] );\n      }\n\n      data.cutFrom = new int[meta.getFieldInStream().length];\n      data.cutTo = new int[meta.getFieldInStream().length];\n      for ( int i = 0; i < meta.getFieldInStream().length; i++ ) {","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/stringcut/StringCut.java#L115-L151","documentation":"StringCut throws this KettleStepException in processRow() when a field configured as the cut input cannot be found in the incoming row stream. indexOfValue() returned -1, meaning the upstream step does not produce a field with that exact name.","triggerScenarios":"At the first processed row (fields are resolved from the first input row's RowMeta) when meta.getFieldInStream()[i] is not present in getInputRowMeta(), e.g. the field was renamed or removed upstream.","commonSituations":"Upstream step renamed/removed the field; case mismatch in field name; transformation edited so hop no longer carries the field; connecting the step to a different stream than designed.","solutions":["Correct the field name in the String Cut step settings to match the actual incoming field (names are case-sensitive)","Fix the upstream step so it emits the expected field","Open the transformation in Spoon and re-map the input field via the step dialog","Validate the row layout by previewing the upstream step's output"],"exampleFix":"// before\n<field><in_stream_name>OldField</in_stream_name>...</field>\n// after\n<field><in_stream_name>RenamedField</in_stream_name>...</field>","handlingStrategy":"validation","validationCode":"// before running the transformation, validate the field exists in the input layout\nRowMetaInterface input = transMeta.getPrevStepFields(stepMeta);\nfor (String f : cutMeta.getFieldInStream()) {\n  if (input.indexOfValue(f) < 0) {\n    throw new IllegalStateException(\"Field not 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(\"StringCut.Exception.FieldRequired\")) {\n    // fix step mapping: re-map or remove the missing field, then re-run\n  }\n}","preventionTips":["Match field names exactly (case-sensitive) with the upstream step","Preview upstream output before configuring field-based steps","Re-open step dialogs after changing upstream steps","Use consistent naming conventions to avoid renames breaking hops"],"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"}