{"record":{"id":"615cedf5cc37cfb5","repo":"pentaho/pentaho-kettle","slug":"getpreviousrowfield-exception-fieldrequired","errorCode":null,"errorMessage":"GetPreviousRowField.Exception.FieldRequired","messagePattern":"GetPreviousRowField\\.Exception\\.FieldRequired","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowField.java","lineNumber":89,"sourceCode":"    if ( r == null ) { // no more input to be expected...\n\n      setOutputDone();\n      return false;\n    }\n\n    if ( first ) {\n      data.inputRowMeta = getInputRowMeta();\n      data.NrPrevFields = data.inputRowMeta.size();\n      data.outputRowMeta = data.inputRowMeta.clone();\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] = data.inputRowMeta.indexOfValue( meta.getFieldInStream()[i] );\n        if ( data.inStreamNrs[i] < 0 ) { // couldn't find field!\n\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"GetPreviousRowField.Exception.FieldRequired\", 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] = meta.getFieldOutStream()[i];\n        if ( Utils.isEmpty( data.outStreamNrs[i] ) ) {\n          throw new KettleStepException( BaseMessages.getString(\n            PKG, \"GetPreviousRowField.Exception.OutputFieldEmpty\", \"\" + i ) );\n        }\n      }\n    } // end if first\n\n    try {\n      Object[] outputRow = getOutputRowData( r );\n\n      putRow( data.outputRowMeta, outputRow ); // copy row to output rowset(s);","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowField.java#L71-L107","documentation":"GetPreviousRowField.processRow() resolves each configured input field name against the incoming row metadata. If a field named in the step settings does not exist in the stream (indexOfValue returns -1), a KettleException is thrown naming the missing field. The step cannot compute previous/current values without the field.","triggerScenarios":"Executing the transformation with a field listed in the step's input fields that is absent from the upstream row layout — e.g. the producing step was renamed, removed, or conditionally skips the field.","commonSituations":"Upstream step renamed a field; a filter/switch branch drops the field; hop re-wiring changed the incoming stream; hand-edited transformation XML with stale field names.","solutions":["Update the step's field-in-stream names to match the actual upstream fields","Add/restore the producing step so the field exists on the input stream","Use 'Get fields' in the step dialog to re-select valid field names"],"exampleFix":"// before (step config)\nField in stream: amount_old   // not in stream\n// after\nField in stream: amount       // matches upstream field","handlingStrategy":"validation","validationCode":"for (String f : meta.getFieldInStream()) { if (inputRowMeta.indexOfValue(f) < 0) { throw new IllegalArgumentException(\"Field missing from stream: \" + f); } }","typeGuard":null,"tryCatchPattern":"try { row = getPreviousRowFieldStep.process(); } catch (KettleException e) { log.error(\"Missing input field: check step config vs upstream layout\"); throw e; }","preventionTips":["Use 'Get fields' in the step dialog instead of typing names","Re-check step config after renaming upstream fields","Preview rows before executing the transformation","Version-control transformations and review hop changes"],"tags":["etl","step-configuration","field-not-found"],"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"}