pentaho/pentaho-kettle · error · KettleException

SwitchCase.Log.NoTargetStepSpecifiedForValue

SwitchCase.Log.NoTargetStepSpecifiedForValue

Error message

SwitchCase.Log.NoTargetStepSpecifiedForValue

What it means

KettleException thrown by SwitchCase.createOutputValueMapping when a SwitchCaseTarget in the step metadata has a non-null case value but a null caseTargetStep, i.e., no target step was specified for that case value. The message includes the case value lacking a target. This is a metadata integrity check performed while building the output value map in processRow.

Solutions

  1. Open the Switch/Case step dialog and assign a valid target step to every case value listed.
  2. Remove case-value rows that are no longer needed instead of leaving them with empty targets.
  3. If a value should fall through, make sure it uses the default target step configured in the dialog.
  4. If loading from XML/repository, re-link the target steps and re-save the transformation.

Example fix

// before: case value with no target in metadata
SwitchCaseTarget t = new SwitchCaseTarget(); t.caseValue = "A";
// after: attach the target step
t.caseTargetStepname = "Output A"; t.caseTargetStep = transMeta.findStep("Output A");
Defensive patterns

Strategy: validation

Validate before calling

// validate every case target is set before running
for ( SwitchCaseTarget t : meta.getCaseTargets() ) {
  if ( t.getCaseValue() != null && t.getCaseTargetStep() == null && t.getCaseTargetStepname() == null )
    throw new KettleException( "No target step for case value: " + t.getCaseValue() );
}

Prevention

When it happens

Trigger: A case value row in the Switch/Case dialog has 'Target step' left empty while 'Use default target' handling does not cover it (target.caseTargetStep == null and target != null); often after importing/editing transformation XML or a repository record where the target step reference was dropped.

Common situations: Deleting the target step from the transformation without clearing the case-value mapping; hand-editing the ktr XML; partial repository migration that lost the target_step attribute; adding a case value in the grid and forgetting to pick a target.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

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

        .getFieldname() ) );
    }

    data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex );

    try {
      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 );

View on GitHub (pinned to f3058517a1)