pentaho/pentaho-kettle · error · KettleStepException

XsdValidator.Exception.XSDFieldMissing

Error message

XsdValidator.Exception.XSDFieldMissing

What it means

KettleStepException thrown when XSD source is 'Specify Fieldname' but no XSD field name is configured (meta.getXSDDefinedField() == null). The step needs to know which incoming field holds the XSD content.

Solutions

  1. Open the step dialog and select the field that contains the XSD under 'Specify fieldname' mode
  2. Or change XSD source to filename/no-need mode
  3. Set the field via code: meta.setXSDDefinedField("xsd_content")
  4. Validate step metadata before running the transformation

Example fix

// before
meta.setXSDSource(meta.SPECIFY_FIELDNAME);
// after
meta.setXSDSource(meta.SPECIFY_FIELDNAME);
meta.setXSDDefinedField("xsd_content");
Defensive patterns

Strategy: validation

Validate before calling

if (meta.getXSDSource().equals(meta.SPECIFY_FIELDNAME) && meta.getXSDDefinedField() == null) { throw new IllegalArgumentException("XSD fieldname must be set when XSD source = fieldname"); }

Try / catch

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

Prevention

When it happens

Trigger: Step meta XSDSource == SPECIFY_FIELDNAME while getXSDDefinedField() is null — field dropdown never set, or metadata lost on import/generation.

Common situations: Programmatic step-meta construction omitting setXSDDefinedField; transformation copied from a template where the mapping differs; UI save not persisted.

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

Appendix: source

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

              logError( BaseMessages.getString( PKG, "XsdValidator.Log.Error.GettingXSDFile" ) );
              throw new KettleStepException( BaseMessages.getString( PKG, "XsdValidator.Exception.GettingXSDFile" ) );
            } finally {
              try {
                if ( xsdfile != null ) {
                  xsdfile.close();
                }
              } catch ( IOException e ) {
                // Ignore errors
              }
            }
          }
        }

        // Is XSD field is provided?
        if ( meta.getXSDSource().equals( meta.SPECIFY_FIELDNAME ) ) {
          if ( meta.getXSDDefinedField() == null ) {
            logError( BaseMessages.getString( PKG, "XsdValidator.Log.Error.XSDFieldMissing" ) );
            throw new KettleStepException( BaseMessages.getString( PKG, "XsdValidator.Exception.XSDFieldMissing" ) );
          } 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" ) );

View on GitHub (pinned to f3058517a1)