pentaho/pentaho-kettle · error · KettleException

XMLJoin.Exception.FieldNotFound

Error message

XMLJoin.Exception.FieldNotFound

What it means

XMLJoin.processRow() searches the target stream's row fields for the field named by meta.getTargetXMLfield(). If no field matches (target_field_id stays -1), it throws a KettleException with the localized message XMLJoin.Exception.FieldNotFound. The XMLJoin step cannot locate the configured target XML field in the incoming target rows.

Solutions

  1. Open the XMLJoin step dialog and set 'Target XML field' to a field that exists in the target stream.
  2. Preview the target stream's output (preview in Spoon) and confirm the exact field name and case.
  3. Update the upstream step so it produces the expected XML field (e.g. re-add the XML field in the source step).
  4. Re-run field discovery: delete and re-configure the XMLJoin mapping after upstream changes.

Example fix

// before: step configured with a field the upstream no longer emits
meta.setTargetXMLfield("xml_content_old");
// after: use the actual field name emitted upstream
meta.setTargetXMLfield("xml_content");
Defensive patterns

Strategy: validation

Validate before calling

// Before running, confirm the configured field exists in the target stream
RowMetaInterface targetRowMeta = targetStep.getStepMetaInterface().getFields(...);
if (!targetRowMeta.searchFieldMeta(meta.getTargetXMLfield()).isPresent()) {
  throw new IllegalStateException("Target XML field missing: " + meta.getTargetXMLfield());
}

Try / catch

try {
  xmlJoinStep.processRow();
} catch (KettleException e) {
  if (e.getMessage().contains("FieldNotFound")) {
    log.error("Configured XML field no longer exists in stream; re-check upstream steps", e);
  }
}

Prevention

When it happens

Trigger: Running the XMLJoin step when the 'Target XML field' configured in the step dialog does not exist in the fields of the target input stream — e.g. the upstream step was renamed, removed, or outputs different columns than when the step was configured.

Common situations: Renaming/deleting the target XML field in an upstream step (Get XML Data, Add XML, etc.) without updating XMLJoin; reusing a transformation where field names changed; case-sensitivity mismatch in field names.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmljoin/XMLJoin.java:102

      // get the first line from the target row set
      Object[] rTarget = getRowFrom( data.TargetRowSet );

      if ( rTarget == null ) { // nothing to do
        logBasic( BaseMessages.getString( PKG, "XMLJoin.NoRowsFoundInTarget" ) );
        setOutputDone();
        return false;
      }

      // get target xml
      String[] target_field_names = data.TargetRowSet.getRowMeta().getFieldNames();
      for ( int i = 0; i < target_field_names.length; i++ ) {
        if ( meta.getTargetXMLfield().equals( target_field_names[i] ) ) {
          target_field_id = i;
        }
      }
      // Throw exception if target field has not been found
      if ( target_field_id == -1 ) {
        throw new KettleException( BaseMessages.getString( PKG, "XMLJoin.Exception.FieldNotFound", meta
            .getTargetXMLfield() ) );
      }

      data.outputRowMeta = data.TargetRowSet.getRowMeta().clone();
      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(),
          new RowMetaInterface[] { data.TargetRowSet.getRowMeta() }, null, getTransMeta(), repository, metaStore );
      data.outputRowData = rTarget.clone();

      // get the target xml structure and create a DOM
      String strTarget = (String) rTarget[target_field_id];
      // parse the XML as a W3C Document

      InputSource inputSource = new InputSource( new StringReader( strTarget ) );

      data.XPathStatement = meta.getTargetXPath();
      try {
        DocumentBuilder builder = XMLParserFactoryProducer.createSecureDocBuilderFactory().newDocumentBuilder();
        data.targetDOM = builder.parse( inputSource );

View on GitHub (pinned to f3058517a1)