pentaho/pentaho-kettle · error · KettleXMLException

JobEntrySetVariables.Meta.UnableLoadXML

Error message

JobEntrySetVariables.Meta.UnableLoadXML

What it means

This KettleXMLException is thrown in loadXML when parsing the Set Variables job entry's XML node fails with a KettleXMLException. It wraps the parse error and prefixes the localized message JobEntrySetVariables.Meta.UnableLoadXML, preserving the original exception as the cause. It signals malformed or unexpected XML for this entry.

Solutions

  1. Open the .kjb in an XML editor and fix the malformed section near the Set Variables entry (the cause message pinpoints it)
  2. Restore the job file from version control or backup
  3. Recreate the Set Variables entry in Spoon and re-save the job
  4. If the file is from a newer PDI version, open it with a matching or newer Pentaho version

Example fix

// before (hand-edited kjb)
<variable_name>VAR1<variable_name>
// after
<variable_name>VAR1</variable_name>
Defensive patterns

Strategy: try-catch

Validate before calling

// before loading the kjb
File f = new File(jobPath);
if (!f.isFile() || f.length() == 0) throw new IllegalStateException("Job file missing or empty: " + jobPath);
// quick well-formedness probe
new XMLReaderImpl().parse(new InputSource(new FileInputStream(f)));

Try / catch

try {
  JobMeta jobMeta = new JobMeta(log, jobPath, metaStore, provider);
} catch (KettleXMLException e) {
  logError("Malformed job XML: " + e.getMessage(), e);
  // restore from VCS/backup or repair the XML
}

Prevention

When it happens

Trigger: Loading a .kjb job file whose <fields> block for the Set Variables entry contains malformed XML (unclosed tags, unexpected structure) that XMLHandler chokes on while reading variable_name/variable_value/variable_type.

Common situations: Job file hand-edited or truncated; file corrupted by version control merge conflicts; file written by a newer Pentaho version with elements an older parser rejects; wrong encoding/BOM issues.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/setvariables/JobEntrySetVariables.java:167

      filename = XMLHandler.getTagValue( entrynode, "filename" );
      fileVariableType = getVariableType( XMLHandler.getTagValue( entrynode, "file_variable_type" ) );

      Node fields = XMLHandler.getSubNode( entrynode, "fields" );
      // How many field variableName?
      int nrFields = XMLHandler.countNodes( fields, "field" );
      allocate( nrFields );

      // Read them all...
      for ( int i = 0; i < nrFields; i++ ) {
        Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );

        variableName[i] = XMLHandler.getTagValue( fnode, "variable_name" );
        variableValue[i] = XMLHandler.getTagValue( fnode, "variable_value" );
        variableType[i] = getVariableType( XMLHandler.getTagValue( fnode, "variable_type" ) );

      }
    } catch ( KettleXMLException xe ) {
      throw new KettleXMLException( BaseMessages.getString( PKG, "JobEntrySetVariables.Meta.UnableLoadXML", xe
        .getMessage() ), xe );
    }
  }

  public void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,
    List<SlaveServer> slaveServers ) throws KettleException {
    try {
      replaceVars = rep.getJobEntryAttributeBoolean( id_jobentry, "replacevars" );

      filename = rep.getJobEntryAttributeString( id_jobentry, "filename" );
      fileVariableType = getVariableType( rep.getJobEntryAttributeString( id_jobentry, "file_variable_type" ) );

      // How many variableName?
      int argnr = rep.countNrJobEntryAttributes( id_jobentry, "variable_name" );
      allocate( argnr );

      // Read them all...
      for ( int a = 0; a < argnr; a++ ) {

View on GitHub (pinned to f3058517a1)