pentaho/pentaho-kettle · error · KettleException

Field [

Error message

Field [

What it means

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.

Solutions

  1. Open the XML Output dialog and re-select the output fields against the current input stream
  2. Fix the upstream step so the field is produced with the expected name
  3. Use 'Get Fields' in the step dialog instead of typing field names manually
  4. Add a dummy/constant step upstream if the field must always exist

Example fix

// before
<field name="custid"/>
// after
<field name="customer_id"/> <!-- matches renamed upstream field -->
Defensive patterns

Strategy: validation

Validate before calling

String[] fields = meta.getOutputFieldNames();
for (String f : fields) { if (inputRowMeta.indexOfValue(f) < 0) throw new IllegalStateException("Missing input field: " + f); }

Type guard

boolean fieldPresent = inputRowMeta.indexOfValue(fieldName) >= 0;

Try / catch

try { step.processRow(); } catch (KettleException e) { log.error("Field lookup failed; re-sync output fields", e); }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/c12632ea9ea3b1d7. Report an issue: GitHub.

Appendix: source

Thrown at plugins/xml/core/src/main/java/org/pentaho/di/trans/steps/xmloutput/XMLOutput.java:139

    if ( checkFeedback( getLinesOutput() ) ) {
      logBasic( "linenr " + getLinesOutput() );
    }

    return result;
  }

  private void writeRowToFile( RowMetaInterface rowMeta, Object[] r ) throws KettleException {
    try {
      if ( first ) {
        data.formatRowMeta = rowMeta.clone();

        first = false;

        data.fieldnrs = new int[meta.getOutputFields().length];
        for ( int i = 0; i < meta.getOutputFields().length; i++ ) {
          data.fieldnrs[i] = data.formatRowMeta.indexOfValue( meta.getOutputFields()[i].getFieldName() );
          if ( data.fieldnrs[i] < 0 ) {
            throw new KettleException( "Field [" + meta.getOutputFields()[i].getFieldName()
                + "] couldn't be found in the input stream!" );
          }

          // Apply the formatting settings to the valueMeta object...
          //
          ValueMetaInterface valueMeta = data.formatRowMeta.getValueMeta( data.fieldnrs[i] );
          XMLField field = meta.getOutputFields()[i];
          valueMeta.setConversionMask( field.getFormat() );
          valueMeta.setLength( field.getLength(), field.getPrecision() );
          valueMeta.setDecimalSymbol( field.getDecimalSymbol() );
          valueMeta.setGroupingSymbol( field.getGroupingSymbol() );
          valueMeta.setCurrencySymbol( field.getCurrencySymbol() );
        }
      }

      if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) {
        /*
         * Write all values in stream to text file.

View on GitHub (pinned to f3058517a1)