{"record":{"id":"f6e98a94672b04a8","repo":"pentaho/pentaho-kettle","slug":"the-simple-mapping-step-needs-one-mapping-input-step-to","errorCode":null,"errorMessage":"The simple mapping step needs one Mapping Input step to write to in the sub-transformation","messagePattern":"The simple mapping step needs one Mapping Input step to write to in the sub-transformation","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMapping.java","lineNumber":180,"sourceCode":"    // We launch the transformation in the processRow when the first row is\n    // received.\n    // This will allow the correct variables to be passed.\n    // Otherwise the parent is the init() thread which will be gone once the\n    // init is done.\n    //\n    try {\n      simpleMappingData.mappingTrans.prepareExecution( getTrans().getArguments() );\n    } catch ( KettleException e ) {\n      throw new KettleException( BaseMessages.getString( PKG,\n          \"SimpleMapping.Exception.UnableToPrepareExecutionOfMapping\" ), e );\n    }\n\n    // If there is no read/write logging step set, we can insert the data from\n    // the first mapping input/output step...\n    //\n    MappingInput[] mappingInputs = simpleMappingData.mappingTrans.findMappingInput();\n    if ( mappingInputs.length == 0 ) {\n      throw new KettleException(\n        \"The simple mapping step needs one Mapping Input step to write to in the sub-transformation\" );\n    }\n    if ( mappingInputs.length > 1 ) {\n      throw new KettleException(\n        \"The simple mapping step does not support multiple Mapping Input steps to write to in the sub-transformation\" );\n    }\n    simpleMappingData.mappingInput = mappingInputs[0];\n    simpleMappingData.mappingInput.setConnectorSteps( new StepInterface[0], new ArrayList<MappingValueRename>(), null );\n\n    // LogTableField readField = data.mappingTransMeta.getTransLogTable().findField(TransLogTable.ID.LINES_READ);\n    // if (readField.getSubject() == null) {\n    // readField.setSubject(data.mappingInput.getStepMeta());\n    // }\n\n    MappingOutput[] mappingOutputs = simpleMappingData.mappingTrans.findMappingOutput();\n    if ( mappingOutputs.length == 0 ) {\n      throw new KettleException(\n          \"The simple mapping step needs one Mapping Output step to read from in the sub-transformation\" );","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/simplemapping/SimpleMapping.java#L162-L198","documentation":"After preparing the mapping sub-transformation, SimpleMapping looks for the Mapping Input step(s) it should write data to. The simple mapping supports exactly one; if findMappingInput() returns zero, this KettleException is thrown because the parent step has no target inside the sub-transformation.","triggerScenarios":"prepareMappingExecution (from init) calls simpleMappingData.mappingTrans.findMappingInput() and gets an empty array — the sub-transformation contains no Mapping Input step.","commonSituations":"Building a mapping sub-transformation from scratch and forgetting the 'Mapping Input' step; deleting it during refactoring; pointing the Simple Mapping step at a normal .ktr instead of a mapping .ktr.","solutions":["Add exactly one 'Mapping Input' step to the sub-transformation and connect it to the rest of the flow","Confirm the referenced sub-transformation is actually a mapping (.ktr with Mapping Input/Output), not an ordinary transformation","Re-point the Simple Mapping step's sub-transformation setting to the correct mapping file"],"exampleFix":"// before (sub-transformation)\n[Text Input] -> [Sort] -> [Mapping Output]\n// after\n[Mapping Input] -> [Sort] -> [Mapping Output]","handlingStrategy":"validation","validationCode":"TransMeta sub = new TransMeta(mappingPath);\nboolean hasMappingInput = sub.getSteps().stream().anyMatch(s -> \"MappingInput\".equals(s.getTypeId()));\nif (!hasMappingInput) throw new IllegalArgumentException(\"mapping lacks Mapping Input step\");","typeGuard":null,"tryCatchPattern":"try { trans.execute(null); } catch (KettleException e) { if (e.getMessage().contains(\"needs one Mapping Input\")) { /* repair sub-transformation then retry init */ } else throw e; }","preventionTips":["Always start a mapping sub-transformation with a Mapping Input step","Never point Simple Mapping at an ordinary transformation","Template new mappings from a known-good skeleton"],"tags":["kettle","pdi","mapping","sub-transformation","mapping-input"],"backgroundTag":"missing-required-argument","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"}