pentaho/pentaho-kettle · error · KettleStepException

XsdValidator.Exception.XmlStreamFieldMissing

Error message

XsdValidator.Exception.XmlStreamFieldMissing

What it means

Field-resolution failure in XsdValidator.processRow: XSD-source-in-field mode is active, but the configured XSD field cannot be found in the input stream (indexOfValue returned -1). The step aborts on the first row when the XSD definition field is unreachable.

Solutions

  1. Open the step dialog and set the 'XML stream field' to the field holding the XML
  2. Confirm upstream steps emit that field (Get fields / preview)
  3. Set it in code: meta.setXMLStreamField("xml_content")
  4. Validate the transformation metadata before execution

Example fix

// before
XsdValidatorMeta meta = new XsdValidatorMeta(); meta.setXSDSource(meta.SPECIFY_FILENAME);
// after
XsdValidatorMeta meta = new XsdValidatorMeta(); meta.setXMLStreamField("xml_content"); meta.setXSDSource(meta.SPECIFY_FILENAME);
Defensive patterns

Strategy: validation

Validate before calling

if (meta.getXMLStreamField() == null || getInputRowMeta().indexOfValue(meta.getXMLStreamField()) < 0) { throw new IllegalStateException("XML stream field missing or absent in stream"); }

Try / catch

try { run(); } catch (KettleStepException e) { if (e.getMessage().contains("XmlStreamFieldMissing")) { configureXmlField(); } else { throw e; } }

Prevention

When it happens

Trigger: The XML fieldname in step meta is null/empty at processRow time — XML field never selected in the dialog or lost from metadata; also raised on the else-branch after the XSD source checks.

Common situations: Step added but never fully configured; XML field removed upstream so configuration resets; programmatic meta build missing setXMLStreamField.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java:159

          } else {
            // Let's check if the XSD field exist
            // Try to get XML Field index
            data.xsdindex = getInputRowMeta().indexOfValue( meta.getXSDDefinedField() );

            if ( data.xsdindex < 0 ) {
              // The field is unreachable !
              logError( BaseMessages
                  .getString( PKG, "XsdValidator.Log.ErrorFindingXSDField", meta.getXSDDefinedField() ) );
              throw new KettleStepException( BaseMessages.getString( PKG,
                  "XsdValidator.Exception.ErrorFindingXSDField", meta.getXSDDefinedField() ) );
            }
          }
        }

      } else {
        // XML stream field is missing !
        logError( BaseMessages.getString( PKG, "XsdValidator.Log.Error.XmlStreamFieldMissing" ) );
        throw new KettleStepException( BaseMessages.getString( PKG, "XsdValidator.Exception.XmlStreamFieldMissing" ) );
      }
    }

    try {

      // Get the XML field value
      String XMLFieldvalue = getInputRowMeta().getString( row, data.xmlindex );

      boolean isvalid = false;

      // XSD filename
      String xsdfilename = null;

      if ( meta.getXSDSource().equals( meta.SPECIFY_FILENAME ) ) {
        xsdfilename = environmentSubstitute( meta.getXSDFilename() );
      } else if ( meta.getXSDSource().equals( meta.SPECIFY_FIELDNAME ) ) {
        // Get the XSD field value
        xsdfilename = getInputRowMeta().getString( row, data.xsdindex );

View on GitHub (pinned to f3058517a1)