{"record":{"id":"c12632ea9ea3b1d7","repo":"pentaho/pentaho-kettle","slug":"field","errorCode":null,"errorMessage":"Field [","messagePattern":"Field \\[","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutput.java","lineNumber":139,"sourceCode":"    if ( checkFeedback( getLinesOutput() ) ) {\n      logBasic( \"linenr \" + getLinesOutput() );\n    }\n\n    return result;\n  }\n\n  private void writeRowToFile( RowMetaInterface rowMeta, Object[] r ) throws KettleException {\n    try {\n      if ( first ) {\n        data.formatRowMeta = rowMeta.clone();\n\n        first = false;\n\n        data.fieldnrs = new int[meta.getOutputFields().length];\n        for ( int i = 0; i < meta.getOutputFields().length; i++ ) {\n          data.fieldnrs[i] = data.formatRowMeta.indexOfValue( meta.getOutputFields()[i].getFieldName() );\n          if ( data.fieldnrs[i] < 0 ) {\n            throw new KettleException( \"Field [\" + meta.getOutputFields()[i].getFieldName()\n                + \"] couldn't be found in the input stream!\" );\n          }\n\n          // Apply the formatting settings to the valueMeta object...\n          //\n          ValueMetaInterface valueMeta = data.formatRowMeta.getValueMeta( data.fieldnrs[i] );\n          XMLField field = meta.getOutputFields()[i];\n          valueMeta.setConversionMask( field.getFormat() );\n          valueMeta.setLength( field.getLength(), field.getPrecision() );\n          valueMeta.setDecimalSymbol( field.getDecimalSymbol() );\n          valueMeta.setGroupingSymbol( field.getGroupingSymbol() );\n          valueMeta.setCurrencySymbol( field.getCurrencySymbol() );\n        }\n      }\n\n      if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) {\n        /*\n         * Write all values in stream to text file.","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutput.java#L121-L157","documentation":"XMLOutput.writeRowToFile maps each configured output field to its index in the incoming row stream on the first row. If a configured field name does not exist in the input row metadata, indexOfValue returns -1 and this KettleException is thrown. It means the XML Output step's field list is out of sync with the actual stream.","triggerScenarios":"processRow -> writeRowToFile on the first row when meta.getOutputFields()[i].getFieldName() is absent from data.formatRowMeta (renamed/deleted upstream field, wrong field name typed in the step dialog, or field only present conditionally).","commonSituations":"Upstream step was edited and a field renamed; XML Output configured on a different transformation hop; dynamic rows where the field appears only on some branches.","solutions":["Open the XML Output dialog and re-select the output fields against the current input stream","Fix the upstream step so the field is produced with the expected name","Use 'Get Fields' in the step dialog instead of typing field names manually","Add a dummy/constant step upstream if the field must always exist"],"exampleFix":"// before\n<field name=\"custid\"/>\n// after\n<field name=\"customer_id\"/> <!-- matches renamed upstream field -->","handlingStrategy":"validation","validationCode":"String[] fields = meta.getOutputFieldNames();\nfor (String f : fields) { if (inputRowMeta.indexOfValue(f) < 0) throw new IllegalStateException(\"Missing input field: \" + f); }","typeGuard":"boolean fieldPresent = inputRowMeta.indexOfValue(fieldName) >= 0;","tryCatchPattern":"try { step.processRow(); } catch (KettleException e) { log.error(\"Field lookup failed; re-sync output fields\", e); }","preventionTips":["Use 'Get Fields' in step dialogs instead of typing names","Re-check step field mappings after any upstream change","Run transformation checks (Ctrl+T) before production runs","Avoid dynamic/conditional upstream schemas where possible"],"tags":["kettle","xml","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"}