pentaho/pentaho-kettle · error · KettleXMLException

ScriptMeta.Exception.UnableToLoadStepInfoFromXML

Error message

ScriptMeta.Exception.UnableToLoadStepInfoFromXML

What it means

readData() parses the serialized XML of the Script step (fields, scripts, jsScripts) via XMLHandler. Any parse error or unexpected structure causes it to wrap the exception in a KettleXMLException with message key 'ScriptMeta.Exception.UnableToLoadStepInfoFromXML', thrown from loadXML during step metadata deserialization.

Solutions

  1. Open the .ktr in a text editor and validate the Script step's XML block against a working example from the same PDI version.
  2. Recreate the Script step in Spoon and re-enter the script/fields instead of editing XML manually.
  3. Align the PDI version used to open the transformation with the version that created it.
  4. Check the nested cause ('Caused by') for the exact XMLHandler failure (missing tag, bad number).

Example fix

// before: hand-edited step XML missing required tag
<replace>X</replace>
// after: use valid boolean value
<replace>Y</replace>
Defensive patterns

Strategy: try-catch

Validate before calling

// Before loading, sanity-check the Script step XML block
// (every field node has name/type/length/precision/replace tags)
grep -c '<field_name>' yourTransformation.ktr

Try / catch

try { transMeta.loadXML(file, ...); } catch (KettleXMLException e) {
  log.error("Script step XML load failed: " + e.getCause(), e);
  // fall back to re-creating the step or an earlier backup file
}

Prevention

When it happens

Trigger: Loading a .ktr transformation whose <step type='Script'> XML is malformed, was produced by an incompatible PDI version, or has missing tags like field_name/field_type/replace.

Common situations: Opening transformations exported from newer/older Pentaho versions; hand-edited XML; truncated or corrupted .ktr files; repository import of foreign metadata.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptMeta.java:250

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

      allocate( nrfields );

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

        fieldname[i] = XMLHandler.getTagValue( fnode, "name" );
        rename[i] = XMLHandler.getTagValue( fnode, "rename" );
        type[i] = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( fnode, "type" ) );

        String slen = XMLHandler.getTagValue( fnode, "length" );
        String sprc = XMLHandler.getTagValue( fnode, "precision" );
        length[i] = Const.toInt( slen, -1 );
        precision[i] = Const.toInt( sprc, -1 );
        replace[i] = "Y".equalsIgnoreCase( XMLHandler.getTagValue( fnode, "replace" ) );
      }
    } catch ( Exception e ) {
      throw new KettleXMLException( BaseMessages.getString(
        PKG, "ScriptMeta.Exception.UnableToLoadStepInfoFromXML" ), e );
    }
  }

  public void setDefault() {
    jsScripts = new ScriptValuesScript[1];
    jsScripts[0] =
      new ScriptValuesScript( ScriptValuesScript.TRANSFORM_SCRIPT, BaseMessages
        .getString( PKG, "Script.Script1" ), "//"
        + BaseMessages.getString( PKG, "Script.ScriptHere" ) + Const.CR + Const.CR );

    int nrfields = 0;
    allocate( nrfields );

    for ( int i = 0; i < nrfields; i++ ) {
      fieldname[i] = "newvalue";
      rename[i] = "newvalue";
      type[i] = ValueMetaInterface.TYPE_NUMBER;

View on GitHub (pinned to f3058517a1)