pentaho/pentaho-kettle · error · KettleXMLException

Unable to read step information from XML

Error message

Unable to read step information from XML

What it means

GetVariableMeta.readData (called from loadXML) rebuilds the step's field definitions from the transformation XML and wraps any exception in a KettleXMLException with the literal message 'Unable to read step information from XML'. Field type values are normalized (TYPE_NONE becomes TYPE_STRING) but any structural parsing failure surfaces here.

Solutions

  1. Inspect e.getCause() (often NumberFormatException) to find the malformed attribute.
  2. Open the .ktr in Spoon and re-create the Get Variable step to regenerate valid XML.
  3. Validate XML well-formedness and that each <field> has field_name, variable_name and valid type/length/precision values.
  4. Restore the .ktr from version control or backup if it was corrupted by editing.

Example fix

// before: invalid numeric attribute in step XML
<length>abc</length>
// after
<length>10</length>
Defensive patterns

Strategy: try-catch

Validate before calling

// well-formedness check before loading
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse( new File( ktrPath ) );

Try / catch

try {
  TransMeta tm = new TransMeta( ktrPath );
} catch ( KettleXMLException e ) {
  if ( e.getMessage().contains( "Unable to read step information from XML" ) ) {
    logError( "Get Variable step XML corrupted: " + e.getCause() );
  }
}

Prevention

When it happens

Trigger: loadXML parses the Get Variable step's <fields> node and an exception occurs — missing 'field_name'/'variable_name' tags, non-numeric length/precision values causing NumberFormatException, or a missing/malformed field node.

Common situations: Truncated or hand-edited .ktr; transformation XML written by an incompatible plugin version; merge conflicts corrupting the fields block of the step XML.

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/43b10d80b4b2e212. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/getvariable/GetVariableMeta.java:129

        fieldDefinitions[i].setFieldType(
          ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( fnode, "type" ) ) );
        fieldDefinitions[i].setFieldFormat( XMLHandler.getTagValue( fnode, "format" ) );
        fieldDefinitions[i].setCurrency( XMLHandler.getTagValue( fnode, "currency" ) );
        fieldDefinitions[i].setDecimal( XMLHandler.getTagValue( fnode, "decimal" ) );
        fieldDefinitions[i].setGroup( XMLHandler.getTagValue( fnode, "group" ) );
        fieldDefinitions[i].setFieldLength( Const.toInt( XMLHandler.getTagValue( fnode, "length" ), -1 ) );
        fieldDefinitions[i].setFieldPrecision( Const.toInt( XMLHandler.getTagValue( fnode, "precision" ), -1 ) );
        fieldDefinitions[i].setTrimType(
          ValueMetaString.getTrimTypeByCode( XMLHandler.getTagValue( fnode, "trim_type" ) ) );

        // Backward compatibility
        //
        if ( fieldDefinitions[i].getFieldType() == ValueMetaInterface.TYPE_NONE ) {
          fieldDefinitions[i].setFieldType( ValueMetaInterface.TYPE_STRING );
        }
      }
    } catch ( Exception e ) {
      throw new KettleXMLException( "Unable to read step information from XML", e );
    }
  }

  @Override
  public void setDefault() {
    int count = 0;

    allocate( count );

    for ( int i = 0; i < count; i++ ) {
      fieldDefinitions[i].setFieldName( "field" + i );
      fieldDefinitions[i].setVariableString( "" );
    }
  }

  @Override
  public void getFields( Bowl bowl, RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info,
      StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {

View on GitHub (pinned to f3058517a1)