pentaho/pentaho-kettle · error · KettleException

Unable to hydrate previous result

Error message

Unable to hydrate previous result

What it means

When loading a JobExecutionConfiguration from XML, the <previous_result> node is parsed by constructing new Result(resultNode). If that construction throws a KettleException, it is re-wrapped with this message. It means the serialized previous Result blob in the execution-configuration XML is invalid or incompatible.

Solutions

  1. Inspect the chained cause (e) to see which Result field failed to parse.
  2. Regenerate the execution configuration XML instead of repairing it by hand.
  3. Remove the <previous_result> node if a previous result is not needed; the loader tolerates its absence (resultNode != null check).
  4. Ensure the XML was produced by a compatible Pentaho version.

Example fix

// before: hand-edited XML with broken previous_result
// <previous_result><nr_errors>abc</nr_errors></previous_result>
// after: drop or fix the node
// <previous_result><nr_errors>0</nr_errors></previous_result>
// or regenerate via:
String xml = executionConfiguration.getXML(); // authoritative serialization
Defensive patterns

Strategy: try-catch

Validate before calling

String xml = execCfgXmlString;
if (xml.contains("<previous_result>")) {
  try { XMLHandler.loadXMLString(xml, Result.XML_TAG); }
  catch (Exception ex) { xml = xml.replaceAll("<previous_result>.*</previous_result>", ""); }
}

Try / catch

try {
  JobExecutionConfiguration cfg = new JobExecutionConfiguration(trecNode, jobMeta, job);
} catch (KettleException e) {
  if (e.getMessage().contains("hydrate previous result")) {
    log.warn("Ignoring corrupt previous_result: {}", e.getCause());
    cfg = loadWithoutPreviousResult(trecNode);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling the XML-loading constructor JobExecutionConfiguration(Node trecNode, ...) where the Result.XML_TAG subnode exists but its contents cannot be unmarshalled into a Result (missing attributes, corrupted or hand-edited XML, result XML written by an incompatible version).

Common situations: Hand-edited execution configuration files; XML files shared across incompatible Pentaho versions where the Result schema changed; truncated XML files produced by an earlier crashed export.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/JobExecutionConfiguration.java:467

    logLevel = LogLevel.getLogLevelForCode( XMLHandler.getTagValue( trecNode, "log_level" ) );
    clearingLog = "Y".equalsIgnoreCase( XMLHandler.getTagValue( trecNode, "clear_log" ) );

    startCopyName = XMLHandler.getTagValue( trecNode, "start_copy_name" );
    startCopyNr = Const.toInt( XMLHandler.getTagValue( trecNode, "start_copy_nr" ), 0 );

    gatheringMetrics = "Y".equalsIgnoreCase( XMLHandler.getTagValue( trecNode, "gather_metrics" ) );

    String sPassedBatchId = XMLHandler.getTagValue( trecNode, "passedBatchId" );
    if ( !StringUtils.isEmpty( sPassedBatchId ) ) {
      passedBatchId = Long.parseLong( sPassedBatchId );
    }

    Node resultNode = XMLHandler.getSubNode( trecNode, Result.XML_TAG );
    if ( resultNode != null ) {
      try {
        previousResult = new Result( resultNode );
      } catch ( KettleException e ) {
        throw new KettleException( "Unable to hydrate previous result", e );
      }
    }

    // Try to get a handle to the repository from here...
    //
    Node repNode = XMLHandler.getSubNode( trecNode, "repository" );
    if ( repNode != null ) {
      String repositoryName = XMLHandler.getTagValue( repNode, "name" );
      String username = XMLHandler.getTagValue( repNode, "login" );
      String password = Encr.decryptPassword( XMLHandler.getTagValue( repNode, "password" ) );
      connectRepository( repositoryName, username, password );
    }

  }

  public Repository connectRepository( String repositoryName, String username, String password ) throws KettleException {
    // Verify that the repository exists on the slave server...
    //

View on GitHub (pinned to f3058517a1)