{"record":{"id":"181b2cc28ba2d6a2","repo":"pentaho/pentaho-kettle","slug":"mappinginputmeta-exception-unabletoloadstepinfofromxml","errorCode":"MappingInputMeta.Exception.UnableToLoadStepInfoFromXML","errorMessage":"Unable to load step info from XML","messagePattern":"Unable to load step info from XML","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java","lineNumber":183,"sourceCode":"\n      allocate( nrfields );\n\n      for ( int i = 0; i < nrfields; i++ ) {\n        Node fnode = XMLHandler.getSubNodeByNr( fields, \"field\", i );\n\n        fieldName[ i ] = XMLHandler.getTagValue( fnode, \"name\" );\n        fieldType[ i ] = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( fnode, \"type\" ) );\n        String slength = XMLHandler.getTagValue( fnode, \"length\" );\n        String sprecision = XMLHandler.getTagValue( fnode, \"precision\" );\n\n        fieldLength[ i ] = Const.toInt( slength, -1 );\n        fieldPrecision[ i ] = Const.toInt( sprecision, -1 );\n      }\n\n      selectingAndSortingUnspecifiedFields =\n        \"Y\".equalsIgnoreCase( XMLHandler.getTagValue( fields, \"select_unspecified\" ) );\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString(\n        PKG, \"MappingInputMeta.Exception.UnableToLoadStepInfoFromXML\" ), e );\n    }\n  }\n\n  public String getXML() {\n    StringBuilder retval = new StringBuilder( 300 );\n\n    retval.append( \"    <fields>\" ).append( Const.CR );\n    for ( int i = 0; i < fieldName.length; i++ ) {\n      if ( fieldName[ i ] != null && fieldName[ i ].length() != 0 ) {\n        retval.append( \"      <field>\" ).append( Const.CR );\n        retval.append( \"        \" ).append( XMLHandler.addTagValue( \"name\", fieldName[ i ] ) );\n        retval\n          .append( \"        \" ).append( XMLHandler.addTagValue( \"type\",\n            ValueMetaFactory.getValueMetaName( fieldType[ i ] ) ) );\n        retval.append( \"        \" ).append( XMLHandler.addTagValue( \"length\", fieldLength[ i ] ) );\n        retval.append( \"        \" ).append( XMLHandler.addTagValue( \"precision\", fieldPrecision[ i ] ) );\n        retval.append( \"      </field>\" ).append( Const.CR );","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java#L165-L201","documentation":"MappingInputMeta.readData() parses the step's XML definition (inside <fields>: field names, types, lengths, select_unspecified flag). Any Exception during parsing (missing tags, malformed XML, unexpected structure) is rethrown as a KettleXMLException with this message, wrapping the original cause. It means the Mapping Input step's serialized definition could not be loaded.","triggerScenarios":"loadXML -> readData on a .ktr file whose <step type='MappingInput'> block is malformed, truncated, hand-edited, or produced by an incompatible PDI version.","commonSituations":"Corrupted/hand-edited .ktr files; transformations exported from newer Pentaho versions loaded into older ones; repository/CDN round-trip damage; missing <fields> element.","solutions":["Inspect the wrapped cause (getCause()) to find the exact parsing problem.","Open the .ktr in a text editor and validate the <step type='MappingInput'> XML structure, especially the <fields> element.","Recreate the Mapping Input step in Spoon and re-save the transformation.","Load the file with the same or newer PDI version that produced it."],"exampleFix":"// before: hand-edited XML missing the flag\n<select_unspecified></broken>\n// after\n<select_unspecified>Y</select_unspecified>","handlingStrategy":"try-catch","validationCode":"// Validate the XML fragment before loading the transformation\nString xml = new String(Files.readAllBytes(Paths.get(ktrPath)));\nif (!xml.contains(\"<step type=\\\"MappingInput\\\">\")) return; // nothing to validate\nDocument doc = DocumentBuilderFactory.newInstance().newDocumentBuilder()\n    .parse(new InputSource(new StringReader(xml))); // throws early on malformed XML","typeGuard":"boolean isWellFormedXml(String xml) {\n  try { DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(xml))); return true; }\n  catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n  transMeta = new TransMeta(ktrPath);\n} catch (KettleXMLException e) {\n  if (e.getMessage().contains(\"Unable to load step info from XML\")) {\n    Throwable cause = e.getCause(); // inspect real parse failure\n  }\n  throw e;\n}","preventionTips":["Never hand-edit .ktr XML; edit via Spoon and re-save.","Pin matching PDI versions across design and runtime environments.","Keep .ktr files under version control to detect corruption.","Always log getCause() of KettleXMLException for the real parse error."],"tags":["kettle","pdi","xml","serialization","step-metadata"],"backgroundTag":"json-parse-error","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"}