{"record":{"id":"06f2ec96bef85ffc","repo":"pentaho/pentaho-kettle","slug":"xsdvalidator-exception-xmlstreamfieldmissing","errorCode":null,"errorMessage":"XsdValidator.Exception.XmlStreamFieldMissing","messagePattern":"XsdValidator\\.Exception\\.XmlStreamFieldMissing","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java","lineNumber":159,"sourceCode":"          } 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\" ) );\n        throw new KettleStepException( BaseMessages.getString( PKG, \"XsdValidator.Exception.XmlStreamFieldMissing\" ) );\n      }\n    }\n\n    try {\n\n      // Get the XML field value\n      String XMLFieldvalue = getInputRowMeta().getString( row, data.xmlindex );\n\n      boolean isvalid = false;\n\n      // XSD filename\n      String xsdfilename = null;\n\n      if ( meta.getXSDSource().equals( meta.SPECIFY_FILENAME ) ) {\n        xsdfilename = environmentSubstitute( meta.getXSDFilename() );\n      } else if ( meta.getXSDSource().equals( meta.SPECIFY_FIELDNAME ) ) {\n        // Get the XSD field value\n        xsdfilename = getInputRowMeta().getString( row, data.xsdindex );","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java#L141-L177","documentation":"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.","triggerScenarios":"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.","commonSituations":"Step added but never fully configured; XML field removed upstream so configuration resets; programmatic meta build missing setXMLStreamField.","solutions":["Open the step dialog and set the 'XML stream field' to the field holding the XML","Confirm upstream steps emit that field (Get fields / preview)","Set it in code: meta.setXMLStreamField(\"xml_content\")","Validate the transformation metadata before execution"],"exampleFix":"// before\nXsdValidatorMeta meta = new XsdValidatorMeta(); meta.setXSDSource(meta.SPECIFY_FILENAME);\n// after\nXsdValidatorMeta meta = new XsdValidatorMeta(); meta.setXMLStreamField(\"xml_content\"); meta.setXSDSource(meta.SPECIFY_FILENAME);","handlingStrategy":"validation","validationCode":"if (meta.getXMLStreamField() == null || getInputRowMeta().indexOfValue(meta.getXMLStreamField()) < 0) { throw new IllegalStateException(\"XML stream field missing or absent in stream\"); }","typeGuard":null,"tryCatchPattern":"try { run(); } catch (KettleStepException e) { if (e.getMessage().contains(\"XmlStreamFieldMissing\")) { configureXmlField(); } else { throw e; } }","preventionTips":["Always select the XML stream field as the first configuration step","Guard against upstream field removal with a Select values alias","Test transformations end-to-end after edits"],"tags":["kettle","xsd-validator","missing-config","xml-field"],"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"}