{"record":{"id":"e540821f06b096af","repo":"pentaho/pentaho-kettle","slug":"xslt-exception-couldnotfindfield","errorCode":null,"errorMessage":"Xslt.Exception.CouldnotFindField","messagePattern":"Xslt\\.Exception\\.CouldnotFindField","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xslt/Xslt.java","lineNumber":99,"sourceCode":"        // Result Field is missing !\n        logError( BaseMessages.getString( PKG, \"Xslt.Log.ErrorResultFieldMissing\" ) );\n        throw new KettleStepException( BaseMessages.getString( PKG, \"Xslt.Exception.ErrorResultFieldMissing\" ) );\n      }\n\n      // Check if The XML field is given\n      if ( Utils.isEmpty( meta.getFieldname() ) ) {\n        // Result Field is missing !\n        logError( BaseMessages.getString( PKG, \"Xslt.Exception.ErrorXMLFieldMissing\" ) );\n        throw new KettleStepException( BaseMessages.getString( PKG, \"Xslt.Exception.ErrorXMLFieldMissing\" ) );\n      }\n\n      // Try to get XML Field index\n      data.fieldposition = getInputRowMeta().indexOfValue( meta.getFieldname() );\n      // Let's check the Field\n      if ( data.fieldposition < 0 ) {\n        // The field is unreachable !\n        logError( BaseMessages.getString( PKG, \"Xslt.Log.ErrorFindingField\" ) + \"[\" + meta.getFieldname() + \"]\" );\n        throw new KettleStepException( BaseMessages.getString( PKG, \"Xslt.Exception.CouldnotFindField\", meta\n            .getFieldname() ) );\n      }\n\n      // Check if the XSL Filename is contained in a column\n      if ( meta.useXSLField() ) {\n        if ( Utils.isEmpty( meta.getXSLFileField() ) ) {\n          // The field is missing\n          // Result field is missing !\n          logError( BaseMessages.getString( PKG, \"Xslt.Log.ErrorXSLFileFieldMissing\" ) );\n          throw new KettleStepException( BaseMessages.getString( PKG, \"Xslt.Exception.ErrorXSLFileFieldMissing\" ) );\n        }\n\n        // Try to get Field index\n        data.fielxslfiledposition = getInputRowMeta().indexOfValue( meta.getXSLFileField() );\n\n        // Let's check the Field\n        if ( data.fielxslfiledposition < 0 ) {\n          // The field is unreachable !","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xslt/Xslt.java#L81-L117","documentation":"The XML fieldname configured on the XSLT step does not exist in the incoming row stream. processRow resolves the field index with getInputRowMeta().indexOfValue(meta.getFieldname()) and, when it returns -1, logs 'ErrorFindingField' and throws this KettleStepException including the field name.","triggerScenarios":"First row arrives; meta.getFieldname() is non-empty but indexOfValue returns < 0 because no incoming field matches that name (case-sensitive).","commonSituations":"Upstream step renamed or removed the XML field; field added by a Select values step that excludes it; typo or case mismatch between dialog value and actual stream field; transformation reordered so the field isn't yet produced.","solutions":["Check the output fields of the previous step and set 'XML fieldname' to the exact (case-sensitive) name.","Re-run 'Get fields' in the XSLT step dialog after fixing upstream metadata.","Add a Select values step to create/keep the expected field if the upstream cannot be changed."],"exampleFix":"// before\nXML fieldname: XmlContent\n// after (upstream field is lowercase)\nXML fieldname: xmlcontent","handlingStrategy":"validation","validationCode":"String fieldName = meta.getFieldname(); if (fieldName != null && previousRowMeta.indexOfValue(fieldName) < 0) { throw new IllegalArgumentException(\"Field '\" + fieldName + \"' not found in incoming stream\"); }","typeGuard":null,"tryCatchPattern":"try { step.startThreads(); } catch (KettleStepException e) { if (e.getMessage().contains(\"CouldnotFindField\")) { /* correct the XML fieldname to match upstream */ } }","preventionTips":["Re-run 'Get fields' in the dialog whenever upstream steps change","Keep field names case-consistent across steps","Avoid removing fields via Select values without checking downstream consumers"],"tags":["xslt","kettle","field-not-found","row-stream"],"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"}