{"record":{"id":"06a688f87fd59bd8","repo":"pentaho/pentaho-kettle","slug":"xsdvalidator-exception-xsdfieldmissing","errorCode":null,"errorMessage":"XsdValidator.Exception.XSDFieldMissing","messagePattern":"XsdValidator\\.Exception\\.XSDFieldMissing","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java","lineNumber":140,"sourceCode":"              logError( BaseMessages.getString( PKG, \"XsdValidator.Log.Error.GettingXSDFile\" ) );\n              throw new KettleStepException( BaseMessages.getString( PKG, \"XsdValidator.Exception.GettingXSDFile\" ) );\n            } finally {\n              try {\n                if ( xsdfile != null ) {\n                  xsdfile.close();\n                }\n              } catch ( IOException e ) {\n                // Ignore errors\n              }\n            }\n          }\n        }\n\n        // Is XSD field is provided?\n        if ( meta.getXSDSource().equals( meta.SPECIFY_FIELDNAME ) ) {\n          if ( meta.getXSDDefinedField() == null ) {\n            logError( BaseMessages.getString( PKG, \"XsdValidator.Log.Error.XSDFieldMissing\" ) );\n            throw new KettleStepException( BaseMessages.getString( PKG, \"XsdValidator.Exception.XSDFieldMissing\" ) );\n          } else {\n            // Let's check if the XSD field exist\n            // Try to get XML Field index\n            data.xsdindex = getInputRowMeta().indexOfValue( meta.getXSDDefinedField() );\n\n            if ( data.xsdindex < 0 ) {\n              // The field is unreachable !\n              logError( BaseMessages\n                  .getString( PKG, \"XsdValidator.Log.ErrorFindingXSDField\", meta.getXSDDefinedField() ) );\n              throw new KettleStepException( BaseMessages.getString( PKG,\n                  \"XsdValidator.Exception.ErrorFindingXSDField\", meta.getXSDDefinedField() ) );\n            }\n          }\n        }\n\n      } else {\n        // XML stream field is missing !\n        logError( BaseMessages.getString( PKG, \"XsdValidator.Log.Error.XmlStreamFieldMissing\" ) );","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java#L122-L158","documentation":"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.","triggerScenarios":"Step meta XSDSource == SPECIFY_FIELDNAME while getXSDDefinedField() is null — field dropdown never set, or metadata lost on import/generation.","commonSituations":"Programmatic step-meta construction omitting setXSDDefinedField; transformation copied from a template where the mapping differs; UI save not persisted.","solutions":["Open the step dialog and select the field that contains the XSD under 'Specify fieldname' mode","Or change XSD source to filename/no-need mode","Set the field via code: meta.setXSDDefinedField(\"xsd_content\")","Validate step metadata before running the transformation"],"exampleFix":"// before\nmeta.setXSDSource(meta.SPECIFY_FIELDNAME);\n// after\nmeta.setXSDSource(meta.SPECIFY_FIELDNAME);\nmeta.setXSDDefinedField(\"xsd_content\");","handlingStrategy":"validation","validationCode":"if (meta.getXSDSource().equals(meta.SPECIFY_FIELDNAME) && meta.getXSDDefinedField() == null) { throw new IllegalArgumentException(\"XSD fieldname must be set when XSD source = fieldname\"); }","typeGuard":null,"tryCatchPattern":"try { run(); } catch (KettleStepException e) { if (e.getMessage().contains(\"XSDFieldMissing\")) { fixStepMeta(); } else { throw e; } }","preventionTips":["Set the XSD field whenever switching the source mode to fieldname","Re-save step dialogs after migrating transformations between environments","Assert step metadata completeness in automated tests"],"tags":["kettle","xsd-validator","missing-config","field-name"],"backgroundTag":"missing-required-config-field","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}