pentaho/pentaho-kettle · error · KettleException

Could not find field

Error message

Could not find field 

What it means

On the first writeLine call, OraBulkDataOutput resolves each configured stream field's index in the incoming row via mi.indexOfValue. If a configured field is not in the row (index < 0), it throws 'Could not find field <name> in stream'. This is a mismatch between the loader's field list and the actual row layout.

Solutions

  1. Open the Oracle Bulk Loader step and refresh the field mapping ('Get fields')
  2. Rename or re-add the missing field upstream so it matches the configured field name
  3. Preview the previous step to confirm exact field names (case/whitespace)

Example fix

// before
meta.setFieldStream( new String[] { "id", "amount_old" } );
// after
meta.setFieldStream( new String[] { "id", "amount" } );
Defensive patterns

Strategy: validation

Validate before calling

for ( String f : meta.getFieldStream() ) {
  if ( mi.indexOfValue( f ) < 0 ) {
    throw new KettleException( "Missing stream field: " + f );
  }
}

Try / catch

try {
  oraOutput.writeLine( rowMeta, row );
} catch ( KettleException e ) {
  logError( "Field mapping stale: " + e.getMessage() );
}

Prevention

When it happens

Trigger: writeLine is called after the field list was lazily initialized and meta.getFieldStream()[i] does not match any value name in the incoming RowMeta — renamed/deleted upstream field or stale step mapping.

Common situations: Upstream step renamed a column; Select Values removed a field; field names differ by case or whitespace; transformation edited without refreshing the loader's field table.

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/765c38bffc230348. Report an issue: GitHub.

Appendix: source

Thrown at plugins/oracle-bulk-loader/impl/src/main/java/org/pentaho/di/trans/steps/orabulkloader/OraBulkDataOutput.java:125

    Const.repl( buf, enclosure, enclosure + enclosure );
    return buf.toString();
  }

  @SuppressWarnings( "ArrayToString" )
  public void writeLine( RowMetaInterface mi, Object[] row ) throws KettleException {
    if ( first ) {
      first = false;

      enclosure = meta.getEnclosure();

      // Setup up the fields we need to take for each of the rows
      // as this speeds up processing.
      fieldNumbers = new int[meta.getFieldStream().length];
      for ( int i = 0; i < fieldNumbers.length; i++ ) {
        fieldNumbers[i] = mi.indexOfValue( meta.getFieldStream()[i] );
        if ( fieldNumbers[i] < 0 ) {
          throw new KettleException( "Could not find field " + meta.getFieldStream()[i] + " in stream" );
        }
      }

      sdfDate = new SimpleDateFormat( "yyyy-MM-dd" );
      sdfDateTime = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSS" );

      outbuf = new StringBuilder();
    }
    outbuf.setLength( 0 );

    // Write the data to the output
    ValueMetaInterface v;
    int number;
    for ( int i = 0; i < fieldNumbers.length; i++ ) {
      if ( i != 0 ) {
        outbuf.append( ',' );
      }
      number = fieldNumbers[i];

View on GitHub (pinned to f3058517a1)