pentaho/pentaho-kettle · error · KettleXMLException

MappingInputMeta.Exception.UnableToLoadStepInfoFromXML

MappingInputMeta.Exception.UnableToLoadStepInfoFromXML

Error message

Unable to load step info from XML

What it means

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.

Solutions

  1. Inspect the wrapped cause (getCause()) to find the exact parsing problem.
  2. Open the .ktr in a text editor and validate the <step type='MappingInput'> XML structure, especially the <fields> element.
  3. Recreate the Mapping Input step in Spoon and re-save the transformation.
  4. Load the file with the same or newer PDI version that produced it.

Example fix

// before: hand-edited XML missing the flag
<select_unspecified></broken>
// after
<select_unspecified>Y</select_unspecified>
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate the XML fragment before loading the transformation
String xml = new String(Files.readAllBytes(Paths.get(ktrPath)));
if (!xml.contains("<step type=\"MappingInput\">")) return; // nothing to validate
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder()
    .parse(new InputSource(new StringReader(xml))); // throws early on malformed XML

Type guard

boolean isWellFormedXml(String xml) {
  try { DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(xml))); return true; }
  catch (Exception e) { return false; }
}

Try / catch

try {
  transMeta = new TransMeta(ktrPath);
} catch (KettleXMLException e) {
  if (e.getMessage().contains("Unable to load step info from XML")) {
    Throwable cause = e.getCause(); // inspect real parse failure
  }
  throw e;
}

Prevention

When it happens

Trigger: loadXML -> readData on a .ktr file whose <step type='MappingInput'> block is malformed, truncated, hand-edited, or produced by an incompatible PDI version.

Common situations: Corrupted/hand-edited .ktr files; transformations exported from newer Pentaho versions loaded into older ones; repository/CDN round-trip damage; missing <fields> element.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java:183

      allocate( nrfields );

      for ( int i = 0; i < nrfields; i++ ) {
        Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );

        fieldName[ i ] = XMLHandler.getTagValue( fnode, "name" );
        fieldType[ i ] = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( fnode, "type" ) );
        String slength = XMLHandler.getTagValue( fnode, "length" );
        String sprecision = XMLHandler.getTagValue( fnode, "precision" );

        fieldLength[ i ] = Const.toInt( slength, -1 );
        fieldPrecision[ i ] = Const.toInt( sprecision, -1 );
      }

      selectingAndSortingUnspecifiedFields =
        "Y".equalsIgnoreCase( XMLHandler.getTagValue( fields, "select_unspecified" ) );
    } catch ( Exception e ) {
      throw new KettleXMLException( BaseMessages.getString(
        PKG, "MappingInputMeta.Exception.UnableToLoadStepInfoFromXML" ), e );
    }
  }

  public String getXML() {
    StringBuilder retval = new StringBuilder( 300 );

    retval.append( "    <fields>" ).append( Const.CR );
    for ( int i = 0; i < fieldName.length; i++ ) {
      if ( fieldName[ i ] != null && fieldName[ i ].length() != 0 ) {
        retval.append( "      <field>" ).append( Const.CR );
        retval.append( "        " ).append( XMLHandler.addTagValue( "name", fieldName[ i ] ) );
        retval
          .append( "        " ).append( XMLHandler.addTagValue( "type",
            ValueMetaFactory.getValueMetaName( fieldType[ i ] ) ) );
        retval.append( "        " ).append( XMLHandler.addTagValue( "length", fieldLength[ i ] ) );
        retval.append( "        " ).append( XMLHandler.addTagValue( "precision", fieldPrecision[ i ] ) );
        retval.append( "      </field>" ).append( Const.CR );

View on GitHub (pinned to f3058517a1)