pentaho/pentaho-kettle · error · KettleException

SwitchCase.Log.UnableToFindTargetRowSetForStep

SwitchCase.Log.UnableToFindTargetRowSetForStep

Error message

SwitchCase.Log.UnableToFindTargetRowSetForStep

What it means

KettleException thrown by SwitchCase.createOutputValueMapping when findOutputRowSet(target.caseTargetStep.getName()) returns null, meaning the RowSet for the configured target step could not be found among this step's output hops. The message includes the target step. This indicates the target step exists in metadata but is not actually connected as an output hop at runtime.

Solutions

  1. Reconnect the Switch/Case step to each configured target step with an output hop and save.
  2. Open the Switch/Case dialog and re-select the target steps so mappings point to steps actually wired in the canvas.
  3. Check that target steps are not disabled/removed at runtime.
  4. Re-save and re-run the transformation after restructuring hops to flush stale references.
Defensive patterns

Strategy: validation

Validate before calling

// confirm each target step is connected as an output hop
for ( SwitchCaseTarget t : meta.getCaseTargets() ) {
  StepMeta sm = transMeta.findStep( t.getCaseTargetStepname() );
  if ( sm == null || !transMeta.isStepConnectedTo( meta.getStepMeta(), sm ) )
    throw new KettleException( "Target not connected: " + t.getCaseTargetStepname() );
}

Prevention

When it happens

Trigger: The case target step was disconnected from the Switch/Case step (hop removed) while the mapping still references it; the target step name in metadata differs from the runtime step; or the transformation's hop structure changed without re-saving the Switch/Case mappings.

Common situations: Dragging/re-wiring hops in Spoon and leaving stale mappings; importing a transformation where hops failed to be created; conditional/target step disabled during execution so no row set was created for it.

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/150f7458f0973986. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCase.java:179

      StepIOMetaInterface ioMeta = meta.getStepIOMeta();

      // There is one or many case target for each target stream.
      // The ioMeta object has one more target stream for the default target though.
      //
      List<StreamInterface> targetStreams = ioMeta.getTargetStreams();
      for ( int i = 0; i < targetStreams.size(); i++ ) {
        SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject();
        if ( target == null ) {
          break; // Skip over default option
        }
        if ( target.caseTargetStep == null ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "SwitchCase.Log.NoTargetStepSpecifiedForValue", target.caseValue ) );
        }

        RowSet rowSet = findOutputRowSet( target.caseTargetStep.getName() );
        if ( rowSet == null ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "SwitchCase.Log.UnableToFindTargetRowSetForStep", target.caseTargetStep ) );
        }

        try {
          Object value =
            data.valueMeta.convertDataFromString(
              target.caseValue, data.stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE );

          // If we have a value and a rowset, we can store the combination in the map
          //
          if ( data.valueMeta.isNull( value ) ) {
            data.nullRowSetSet.add( rowSet );
          } else {
            // could not use byte[] as key in Maps, so we need to convert it to his specific hashCode for future
            // comparisons
            value = prepareObjectType( value );
            data.outputMap.put( value, rowSet );
          }

View on GitHub (pinned to f3058517a1)