{"record":{"id":"3abee5f9a7dfa636","repo":"pentaho/pentaho-kettle","slug":"xsdvalidator-exception-couldnotfindfield","errorCode":null,"errorMessage":"XsdValidator.Exception.CouldnotFindField","messagePattern":"XsdValidator\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java","lineNumber":95,"sourceCode":"      return false;\n    }\n\n    if ( first ) {\n      first = false;\n      data.outputRowMeta = getInputRowMeta().clone();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n                      metaStore );\n\n      // Check if XML stream is given\n      if ( meta.getXMLStream() != null ) {\n        // Try to get XML Field index\n        data.xmlindex = getInputRowMeta().indexOfValue( meta.getXMLStream() );\n        // Let's check the Field\n        if ( data.xmlindex < 0 ) {\n          // The field is unreachable !\n          logError( BaseMessages.getString( PKG, \"XsdValidator.Log.ErrorFindingField\" ) + \"[\" + meta.getXMLStream()\n              + \"]\" );\n          throw new KettleStepException( BaseMessages.getString( PKG, \"XsdValidator.Exception.CouldnotFindField\", meta\n              .getXMLStream() ) );\n        }\n\n        // Let's check that Result Field is given\n        if ( meta.getResultfieldname() == null ) {\n          // Result field is missing !\n          logError( BaseMessages.getString( PKG, \"XsdValidator.Log.ErrorResultFieldMissing\" ) );\n          throw new KettleStepException( BaseMessages.getString( PKG, \"XsdValidator.Exception.ErrorResultFieldMissing\" ) );\n        }\n\n        // Is XSD file is provided?\n        if ( meta.getXSDSource().equals( meta.SPECIFY_FILENAME ) ) {\n          if ( meta.getXSDFilename() == null ) {\n            logError( BaseMessages.getString( PKG, \"XsdValidator.Log.ErrorXSDFileMissing\" ) );\n            throw new KettleStepException( BaseMessages.getString( PKG, \"XsdValidator.Exception.ErrorXSDFileMissing\" ) );\n          } else {\n            // Is XSD file exists ?\n            FileObject xsdfile = null;","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xsdvalidator/XsdValidator.java#L77-L113","documentation":"XsdValidator.processRow locates the configured XML stream field in the incoming row via indexOfValue. If the field is missing (index < 0), it logs 'ErrorFindingField' and throws this localized KettleStepException. The step cannot validate because the XML content field does not exist in the stream.","triggerScenarios":"processRow on the first row when meta.getXMLStream() names a field absent from getInputRowMeta(), due to upstream rename/removal, wrong field selection in the dialog, or a branch where the field is not produced.","commonSituations":"Upstream 'Get XML Data' step renamed its output field; XML Validator configured on a stream with different columns; typo in field name.","solutions":["Re-open the XSD Validator dialog and select the correct XML field from the current stream","Fix the upstream step to emit the field with the expected name","Use 'Get Fields' to refresh the field list","Add a Select Values step upstream to guarantee the field exists"],"exampleFix":"// before\nXML stream field: xml_content\n// after\nXML stream field: xmldata  <!-- matches upstream output -->","handlingStrategy":"validation","validationCode":"String xmlField = meta.getXMLStream();\nif (xmlField == null || inputRowMeta.indexOfValue(xmlField) < 0) throw new IllegalStateException(\"XML field missing in stream: \" + xmlField);","typeGuard":"boolean xmlFieldPresent = inputRowMeta.indexOfValue(meta.getXMLStream()) >= 0;","tryCatchPattern":"try { step.processRow(); } catch (KettleStepException e) { log.error(\"XSD Validator field missing; fix field mapping\", e); }","preventionTips":["Refresh field selection with 'Get Fields' after upstream edits","Run transformation checks before production","Keep upstream field names stable; rename via Select Values deliberately","Pin the expected schema with a row sample test"],"tags":["kettle","xsd","validation","field-mapping"],"backgroundTag":"record-not-found","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"}