pentaho/pentaho-kettle · error · KettleStepException

Xslt.Exception.CouldnotFindField

Error message

Xslt.Exception.CouldnotFindField

What it means

The XML fieldname configured on the XSLT step does not exist in the incoming row stream. processRow resolves the field index with getInputRowMeta().indexOfValue(meta.getFieldname()) and, when it returns -1, logs 'ErrorFindingField' and throws this KettleStepException including the field name.

Solutions

  1. Check the output fields of the previous step and set 'XML fieldname' to the exact (case-sensitive) name.
  2. Re-run 'Get fields' in the XSLT step dialog after fixing upstream metadata.
  3. Add a Select values step to create/keep the expected field if the upstream cannot be changed.

Example fix

// before
XML fieldname: XmlContent
// after (upstream field is lowercase)
XML fieldname: xmlcontent
Defensive patterns

Strategy: validation

Validate before calling

String fieldName = meta.getFieldname(); if (fieldName != null && previousRowMeta.indexOfValue(fieldName) < 0) { throw new IllegalArgumentException("Field '" + fieldName + "' not found in incoming stream"); }

Try / catch

try { step.startThreads(); } catch (KettleStepException e) { if (e.getMessage().contains("CouldnotFindField")) { /* correct the XML fieldname to match upstream */ } }

Prevention

When it happens

Trigger: First row arrives; meta.getFieldname() is non-empty but indexOfValue returns < 0 because no incoming field matches that name (case-sensitive).

Common situations: Upstream step renamed or removed the XML field; field added by a Select values step that excludes it; typo or case mismatch between dialog value and actual stream field; transformation reordered so the field isn't yet produced.

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

Appendix: source

Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xslt/Xslt.java:99

        // Result Field is missing !
        logError( BaseMessages.getString( PKG, "Xslt.Log.ErrorResultFieldMissing" ) );
        throw new KettleStepException( BaseMessages.getString( PKG, "Xslt.Exception.ErrorResultFieldMissing" ) );
      }

      // Check if The XML field is given
      if ( Utils.isEmpty( meta.getFieldname() ) ) {
        // Result Field is missing !
        logError( BaseMessages.getString( PKG, "Xslt.Exception.ErrorXMLFieldMissing" ) );
        throw new KettleStepException( BaseMessages.getString( PKG, "Xslt.Exception.ErrorXMLFieldMissing" ) );
      }

      // Try to get XML Field index
      data.fieldposition = getInputRowMeta().indexOfValue( meta.getFieldname() );
      // Let's check the Field
      if ( data.fieldposition < 0 ) {
        // The field is unreachable !
        logError( BaseMessages.getString( PKG, "Xslt.Log.ErrorFindingField" ) + "[" + meta.getFieldname() + "]" );
        throw new KettleStepException( BaseMessages.getString( PKG, "Xslt.Exception.CouldnotFindField", meta
            .getFieldname() ) );
      }

      // Check if the XSL Filename is contained in a column
      if ( meta.useXSLField() ) {
        if ( Utils.isEmpty( meta.getXSLFileField() ) ) {
          // The field is missing
          // Result field is missing !
          logError( BaseMessages.getString( PKG, "Xslt.Log.ErrorXSLFileFieldMissing" ) );
          throw new KettleStepException( BaseMessages.getString( PKG, "Xslt.Exception.ErrorXSLFileFieldMissing" ) );
        }

        // Try to get Field index
        data.fielxslfiledposition = getInputRowMeta().indexOfValue( meta.getXSLFileField() );

        // Let's check the Field
        if ( data.fielxslfiledposition < 0 ) {
          // The field is unreachable !

View on GitHub (pinned to f3058517a1)