{"record":{"id":"99c4525147328589","repo":"pentaho/pentaho-kettle","slug":"switchcase-log-notargetstepspecifiedforvalue","errorCode":"SwitchCase.Log.NoTargetStepSpecifiedForValue","errorMessage":"SwitchCase.Log.NoTargetStepSpecifiedForValue","messagePattern":"SwitchCase\\.Log\\.NoTargetStepSpecifiedForValue","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCase.java","lineNumber":173,"sourceCode":"        .getFieldname() ) );\n    }\n\n    data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex );\n\n    try {\n      StepIOMetaInterface ioMeta = meta.getStepIOMeta();\n\n      // There is one or many case target for each target stream.\n      // The ioMeta object has one more target stream for the default target though.\n      //\n      List<StreamInterface> targetStreams = ioMeta.getTargetStreams();\n      for ( int i = 0; i < targetStreams.size(); i++ ) {\n        SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject();\n        if ( target == null ) {\n          break; // Skip over default option\n        }\n        if ( target.caseTargetStep == null ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"SwitchCase.Log.NoTargetStepSpecifiedForValue\", target.caseValue ) );\n        }\n\n        RowSet rowSet = findOutputRowSet( target.caseTargetStep.getName() );\n        if ( rowSet == null ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"SwitchCase.Log.UnableToFindTargetRowSetForStep\", target.caseTargetStep ) );\n        }\n\n        try {\n          Object value =\n            data.valueMeta.convertDataFromString(\n              target.caseValue, data.stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE );\n\n          // If we have a value and a rowset, we can store the combination in the map\n          //\n          if ( data.valueMeta.isNull( value ) ) {\n            data.nullRowSetSet.add( rowSet );","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/switchcase/SwitchCase.java#L155-L191","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the Switch/Case step dialog and assign a valid target step to every case value listed.","Remove case-value rows that are no longer needed instead of leaving them with empty targets.","If a value should fall through, make sure it uses the default target step configured in the dialog.","If loading from XML/repository, re-link the target steps and re-save the transformation."],"exampleFix":"// before: case value with no target in metadata\nSwitchCaseTarget t = new SwitchCaseTarget(); t.caseValue = \"A\";\n// after: attach the target step\nt.caseTargetStepname = \"Output A\"; t.caseTargetStep = transMeta.findStep(\"Output A\");","handlingStrategy":"validation","validationCode":"// validate every case target is set before running\nfor ( SwitchCaseTarget t : meta.getCaseTargets() ) {\n  if ( t.getCaseValue() != null && t.getCaseTargetStep() == null && t.getCaseTargetStepname() == null )\n    throw new KettleException( \"No target step for case value: \" + t.getCaseValue() );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave a target step empty for a case value; delete unused rows instead.","After deleting steps in Spoon, reopen Switch/Case and clear dangling references.","Set the default target step as a catch-all.","Validate transformation metadata programmatically before production runs."],"tags":["kettle","switch-case","missing-target","transform"],"backgroundTag":"missing-required-config-field","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"}