pentaho/pentaho-kettle · error · KettleException

FilterRows.Log.TargetStepInvalid

FilterRows.Log.TargetStepInvalid

Error message

FilterRows.Log.TargetStepInvalid

What it means

When the filter's true-branch is wired to a target step, processRow looks up the corresponding output RowSet with findOutputRowSet. If no running step with the configured target stepname exists, the lookup returns null and this KettleException is thrown - the true target step is invalid or not connected.

Solutions

  1. Open the Filter step dialog and re-select a valid step name in the 'true' target field.
  2. Verify a hop exists from the Filter step to the intended true-branch target step.
  3. If true-rows should go to the main output instead, clear the target step name so data.trueRowSet is set to null.

Example fix

// before (XML)
<target_stepname>OldStep</target_stepname>
// after
<target_stepname>ValidNextStep</target_stepname>
Defensive patterns

Strategy: validation

Validate before calling

// Verify the true-target step exists and is hop-connected before running:
StepMeta target = transMeta.findStep(trueTargetName);
if (target == null || transMeta.findStepTo(stepMeta, target) == null) {
  throw new IllegalStateException("Filter true target step invalid: " + trueTargetName);
}

Try / catch

try {
  trans.execute(null);
} catch (KettleException e) {
  if (e.getMessage().contains("TargetStepInvalid")) {
    log.error("Re-wire the Filter step's target hop", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: processRow(): data.chosesTargetSteps is true, targetStreams.get(0) has a non-empty stepname, but findOutputRowSet(getStepname(), getCopy(), stepname, 0) returns null - the true target step does not exist in the transformation or isn't hop-connected.

Common situations: Target step deleted/renamed after the filter was configured; transformation edited via XML where the hop was removed; running an incomplete transformation copy.

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/8fc92a97daa4065e. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/filterrows/FilterRows.java:93

    if ( first ) {
      first = false;

      data.outputRowMeta = getInputRowMeta().clone();
      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
        metaStore );

      // if filter refers to non-existing fields, throw exception
      checkNonExistingFields();

      // Cache the position of the RowSet for the output.
      //
      if ( data.chosesTargetSteps ) {
        List<StreamInterface> targetStreams = meta.getStepIOMeta().getTargetStreams();
        if ( !Utils.isEmpty( targetStreams.get( 0 ).getStepname() ) ) {
          data.trueRowSet = findOutputRowSet( getStepname(), getCopy(), targetStreams.get( 0 ).getStepname(), 0 );
          if ( data.trueRowSet == null ) {
            throw new KettleException( BaseMessages.getString(
              PKG, "FilterRows.Log.TargetStepInvalid", targetStreams.get( 0 ).getStepname() ) );
          }
        } else {
          data.trueRowSet = null;
        }

        if ( !Utils.isEmpty( targetStreams.get( 1 ).getStepname() ) ) {
          data.falseRowSet = findOutputRowSet( getStepname(), getCopy(), targetStreams.get( 1 ).getStepname(), 0 );
          if ( data.falseRowSet == null ) {
            throw new KettleException( BaseMessages.getString(
              PKG, "FilterRows.Log.TargetStepInvalid", targetStreams.get( 1 ).getStepname() ) );
          }
        } else {
          data.falseRowSet = null;
        }
      }
    }

View on GitHub (pinned to f3058517a1)