{"record":{"id":"98cc5d6f97523503","repo":"pentaho/pentaho-kettle","slug":"mappinginput-exception-illegalargumentsourcestep","errorCode":"MappingInput.Exception.IllegalArgumentSourceStep","errorMessage":"Source steps should not be empty.","messagePattern":"Source steps should not be empty\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInput.java","lineNumber":181,"sourceCode":"    } else {\n      putRow( data.outputRowMeta, row );\n    }\n\n    return true;\n  }\n\n  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {\n    meta = (MappingInputMeta) smi;\n    data = (MappingInputData) sdi;\n\n    return super.init( smi, sdi );\n  }\n\n  public void setConnectorSteps( StepInterface[] sourceSteps, List<MappingValueRename> valueRenames,\n      String mappingStepname ) {\n\n    if ( sourceSteps == null ) {\n      throw new IllegalArgumentException( BaseMessages\n          .getString( PKG, \"MappingInput.Exception.IllegalArgumentSourceStep\" ) );\n    }\n\n    if ( valueRenames == null ) {\n      throw new IllegalArgumentException( BaseMessages\n          .getString( PKG, \"MappingInput.Exception.IllegalArgumentValueRename\" ) );\n    }\n\n    if ( sourceSteps.length != 0 ) {\n      if ( mappingStepname == null ) {\n        throw new IllegalArgumentException( BaseMessages\n          .getString( PKG, \"MappingInput.Exception.IllegalArgumentStepName\" ) );\n      }\n    }\n\n    for ( StepInterface sourceStep : sourceSteps ) {\n\n      // We don't want to add the mapping-to-mapping rowset","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInput.java#L163-L199","documentation":"setConnectorSteps() validates its arguments before wiring the parent transformation's source steps to this Mapping Input step. Passing a null array of source steps throws an IllegalArgumentException. The library requires a non-null (possibly empty) array so it can always record data.sourceSteps.","triggerScenarios":"Calling mappingInput.setConnectorSteps(null, valueRenames, stepname) directly, or a code path in prepareMappingExecution that resolves no source steps and passes null instead of an empty array.","commonSituations":"Custom Java code embedding a mapping transformation; testing (e.g., testSetConnectorStepsWithNullArguments); framework integration bugs where the Mapping step's input hops were never resolved.","solutions":["Pass a non-null array; use new StepInterface[0] when there are genuinely no source steps.","Ensure the parent transformation was built/loaded correctly so the Mapping step's input hops resolve to real steps.","Call setConnectorSteps only after the parent Trans has prepared its threads and step instances exist."],"exampleFix":"// before\nmappingInput.setConnectorSteps(null, renames, \"Mapping input\");\n// after\nStepInterface[] sourceSteps = mappingInputStep.getStepInterface();\nmappingInput.setConnectorSteps(sourceSteps == null ? new StepInterface[0] : sourceSteps, renames, \"Mapping input\");","handlingStrategy":"type-guard","validationCode":"if (sourceSteps == null) {\n  sourceSteps = new StepInterface[0]; // normalize before calling setConnectorSteps\n}","typeGuard":"boolean isUsableSourceSteps(StepInterface[] steps) { return steps != null; }","tryCatchPattern":"try {\n  mappingInput.setConnectorSteps(steps, renames, name);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Source steps should not be empty\")) {\n    // resolve parent step instances before wiring\n  }\n  throw e;\n}","preventionTips":["Default to an empty array, never null, for step arrays.","Resolve StepInterface instances from a prepared Trans before calling setConnectorSteps.","Add unit tests mirroring testSetConnectorStepsWithNullArguments in your integration code."],"tags":["kettle","pdi","illegal-argument","null-check","api-misuse"],"backgroundTag":"null-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"}