pentaho/pentaho-kettle · error · KettleXMLException

AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML

Error message

AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML

What it means

KettleXMLException thrown by AnalyticQueryMeta.readData() when parsing the <fields>/<field> XML for an Analytic Query step in a .ktr fails. Typical causes are NumberFormatException from Integer.parseInt on a non-numeric 'valuefield' attribute or any other malformed/unexpected XML. It wraps the original exception, so the root cause is in the chained cause.

Solutions

  1. Inspect the wrapped cause (e.getCause()) — usually NumberFormatException — and fix the offending 'valuefield' value in the .ktr XML to an integer
  2. Open and re-save the Analytic Query step in Spoon so the XML is regenerated from the current schema
  3. Verify the transformation file was produced by a compatible Pentaho/Kettle version and re-export if versions differ
  4. Restore the .ktr from version control or backup if it was hand-edited or truncated

Example fix

// before (malformed XML)
<valuefield>abc</valuefield>
// after
<valuefield>1</valuefield>
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate the Analytic Query XML fragment before loading
Node fnode = XMLHandler.getSubNode(stepNode, "fields");
for (Node f : eachChild(fnode)) {
  String vf = XMLHandler.getTagValue(f, "valuefield");
  Integer.parseInt(vf); // throws NumberFormatException early with clear context
}

Type guard

boolean isParseableInt(String s) { try { Integer.parseInt(s); return true; } catch (NumberFormatException e) { return false; } }

Try / catch

try {
  transMeta.loadXML(xmlInputStream, null, metaStore);
} catch (KettleXMLException e) {
  log.error("Bad Analytic Query XML: " + e.getMessage(), e.getCause());
  // abort load or fall back to a known-good file
}

Prevention

When it happens

Trigger: loadXML() -> readData() encounters XML where the 'valuefield' tag value is not a parseable integer, a required tag ('type', 'valuefield') is missing/empty, or the XML structure under <fields> does not match what getTagValue/NodeFilter expects.

Common situations: Hand-edited or truncated .ktr files; transformations written by a different Pentaho/Kettle version with a changed step XML schema; copying steps between files with partial XML; corruption from external merge tools.

Related errors


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

Appendix: source

Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/analyticquery/AnalyticQueryMeta.java:217

      int nrfields = XMLHandler.countNodes( fields, "field" );

      allocate( sizegroup, nrfields );

      for ( int i = 0; i < sizegroup; i++ ) {
        Node fnode = XMLHandler.getSubNodeByNr( groupn, "field", i );
        groupField[i] = XMLHandler.getTagValue( fnode, "name" );
      }
      for ( int i = 0; i < nrfields; i++ ) {
        Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );
        aggregateField[i] = XMLHandler.getTagValue( fnode, "aggregate" );
        subjectField[i] = XMLHandler.getTagValue( fnode, "subject" );
        aggregateType[i] = getType( XMLHandler.getTagValue( fnode, "type" ) );

        valueField[i] = Integer.parseInt( XMLHandler.getTagValue( fnode, "valuefield" ) );
      }

    } catch ( Exception e ) {
      throw new KettleXMLException( BaseMessages.getString(
        PKG, "AnalyticQueryMeta.Exception.UnableToLoadStepInfoFromXML" ), e );
    }
  }

  public static final int getType( String desc ) {
    for ( int i = 0; i < typeGroupCode.length; i++ ) {
      if ( typeGroupCode[i].equalsIgnoreCase( desc ) ) {
        return i;
      }
    }
    for ( int i = 0; i < typeGroupLongDesc.length; i++ ) {
      if ( typeGroupLongDesc[i].equalsIgnoreCase( desc ) ) {
        return i;
      }
    }
    return 0;
  }

View on GitHub (pinned to f3058517a1)