pentaho/pentaho-kettle · error · KettleException

GetPreviousRowField.Exception.FieldRequired

Error message

GetPreviousRowField.Exception.FieldRequired

What it means

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.

Solutions

  1. Update the step's field-in-stream names to match the actual upstream fields
  2. Add/restore the producing step so the field exists on the input stream
  3. Use 'Get fields' in the step dialog to re-select valid field names

Example fix

// before (step config)
Field in stream: amount_old   // not in stream
// after
Field in stream: amount       // matches upstream field
Defensive patterns

Strategy: validation

Validate before calling

for (String f : meta.getFieldInStream()) { if (inputRowMeta.indexOfValue(f) < 0) { throw new IllegalArgumentException("Field missing from stream: " + f); } }

Try / catch

try { row = getPreviousRowFieldStep.process(); } catch (KettleException e) { log.error("Missing input field: check step config vs upstream layout"); throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/615cedf5cc37cfb5. Report an issue: GitHub.

Appendix: source

Thrown at plugins/get-previous-row-field/core/src/main/java/org/pentaho/di/trans/steps/getpreviousrowfield/GetPreviousRowField.java:89

    if ( r == null ) { // no more input to be expected...

      setOutputDone();
      return false;
    }

    if ( first ) {
      data.inputRowMeta = getInputRowMeta();
      data.NrPrevFields = data.inputRowMeta.size();
      data.outputRowMeta = data.inputRowMeta.clone();
      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
        metaStore );

      data.inStreamNrs = new int[meta.getFieldInStream().length];
      for ( int i = 0; i < meta.getFieldInStream().length; i++ ) {
        data.inStreamNrs[i] = data.inputRowMeta.indexOfValue( meta.getFieldInStream()[i] );
        if ( data.inStreamNrs[i] < 0 ) { // couldn't find field!

          throw new KettleException( BaseMessages.getString(
            PKG, "GetPreviousRowField.Exception.FieldRequired", meta.getFieldInStream()[i] ) );
        }
      }

      data.outStreamNrs = new String[meta.getFieldInStream().length];
      for ( int i = 0; i < meta.getFieldInStream().length; i++ ) {
        data.outStreamNrs[i] = meta.getFieldOutStream()[i];
        if ( Utils.isEmpty( data.outStreamNrs[i] ) ) {
          throw new KettleStepException( BaseMessages.getString(
            PKG, "GetPreviousRowField.Exception.OutputFieldEmpty", "" + i ) );
        }
      }
    } // end if first

    try {
      Object[] outputRow = getOutputRowData( r );

      putRow( data.outputRowMeta, outputRow ); // copy row to output rowset(s);

View on GitHub (pinned to f3058517a1)