pentaho/pentaho-kettle · error · KettleXMLException

Unable to load step info from XML

Error message

Unable to load step info from XML

What it means

AddXMLMeta.readData parses the step's XML definition (from a .ktr file) with XMLHandler.getTagValue calls. Any exception (malformed XML, missing nodes producing unexpected state, class issues) is wrapped in KettleXMLException with the fixed message 'Unable to load step info from XML'. It signals the transformation file's step section is not parseable into AddXMLMeta.

Solutions

  1. Open the .ktr in Spoon and fix or delete the broken AddXML step definition
  2. Diff the step's XML block against a known-good AddXML step and repair missing tags
  3. Check Pentaho/PDI version compatibility between the file and the runtime
  4. Restore the transformation from version control or backup

Example fix

// before (malformed hand-edited step XML)
<field><name>a</name></field>
// after (complete field node)
<field><name>a</name><element>root</element><attribute>N</attribute><length>-1</length><precision>-1</precision></field>
Defensive patterns

Strategy: try-catch

Validate before calling

Document doc = XMLHandler.loadXMLFile(ktrFile);
Node stepNode = findStepNode(doc, "AddXML");
if (stepNode == null || XMLHandler.getNodes(stepNode, "fields").isEmpty()) {
  failFast("AddXML step XML definition incomplete");
}

Try / catch

try { meta.loadXML(stepNode, databases, metaStore, null); }
catch (KettleXMLException e) {
  logError("AddXML step XML unreadable: " + e.getMessage(), e.getCause());
}

Prevention

When it happens

Trigger: loadXML reads a transformation XML whose <fields> entries lack expected child tags or whose XML is malformed, causing getTagValue/loop code to throw inside readData.

Common situations: Hand-edited .ktr files; transformation produced by a newer Pentaho version with a changed XML schema opened in an older version; truncated/corrupt file transfer.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/addxml/AddXMLMeta.java:190

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

        outputFields[i] = new XMLField();
        outputFields[i].setFieldName( XMLHandler.getTagValue( fnode, "name" ) );
        outputFields[i].setElementName( XMLHandler.getTagValue( fnode, "element" ) );
        outputFields[i].setType( XMLHandler.getTagValue( fnode, "type" ) );
        outputFields[i].setFormat( XMLHandler.getTagValue( fnode, "format" ) );
        outputFields[i].setCurrencySymbol( XMLHandler.getTagValue( fnode, "currency" ) );
        outputFields[i].setDecimalSymbol( XMLHandler.getTagValue( fnode, "decimal" ) );
        outputFields[i].setGroupingSymbol( XMLHandler.getTagValue( fnode, "group" ) );
        outputFields[i].setNullString( XMLHandler.getTagValue( fnode, "nullif" ) );
        outputFields[i].setLength( Const.toInt( XMLHandler.getTagValue( fnode, "length" ), -1 ) );
        outputFields[i].setPrecision( Const.toInt( XMLHandler.getTagValue( fnode, "precision" ), -1 ) );
        outputFields[i].setAttribute( "Y".equalsIgnoreCase( XMLHandler.getTagValue( fnode, "attribute" ) ) );
        outputFields[i].setAttributeParentName( XMLHandler.getTagValue( fnode, "attributeParentName" ) );
      }
    } catch ( Exception e ) {
      throw new KettleXMLException( "Unable to load step info from XML", e );
    }
  }

  public void setDefault() {
    omitXMLheader = true;
    omitNullValues = false;
    encoding = Const.XML_ENCODING;

    valueName = "xmlvaluename";
    rootNode = "Row";

    int nrfields = 0;

    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      outputFields[i] = new XMLField();

View on GitHub (pinned to f3058517a1)