pentaho/pentaho-kettle · error · KettleException
Could not find field
Error message
Could not find field
What it means
GPBulkDataOutput.writeLine throws a KettleException 'Could not find field <name> in stream' when a field configured in the bulk loader step's field mapping cannot be located in the incoming row (RowMetaInterface.indexOfValue returns -1). Thrown during first-row setup of fieldNumbers so subsequent writes are fast.
Solutions
- Open the GP Bulk Loader step dialog and re-map the Fields table to the actual upstream fields (Get Fields).
- Verify the upstream step emits the field name exactly (case-sensitive) as configured.
- Insert a Select Values step to add/rename the missing field before the bulk loader.
- Re-check hop connections after refactoring upstream steps.
Example fix
// before: upstream renamed 'amount' to 'total_amount' but loader expects 'amount'
fieldStream = { "amount", "id" };
// after: update the mapping in the step dialog
fieldStream = { "total_amount", "id" }; // matches upstream row Defensive patterns
Strategy: validation
Validate before calling
// before running, verify every configured field exists in the row
RowMetaInterface prev = transMeta.getPrevStepFields( stepName );
for ( String name : meta.getFieldStream() ) {
if ( prev.indexOfValue( name ) < 0 ) {
throw new KettleException( "Field not in stream: " + name );
}
} Prevention
- Re-run 'Get Fields' after any upstream step change
- Keep field names case-consistent across steps
- Use a Select Values step to pin field names before bulk loading
When it happens
Trigger: The first row arrives at the step and one of meta.getFieldStream() names is absent from the row's RowMeta — the upstream step was renamed/removed, field order/naming changed, or the step dialog mapping is stale.
Common situations: Renaming a field in an upstream Text File Input or Table Input step without updating the GP Bulk Loader mapping; removing a computed field; running a transformation edited in a different version where the mapping was not persisted.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- No fields defined to load to database
- CloneRow.Exception.CouldnotFindField
- Field [ ] couldn't be found in the input stream!
- GPload.Exception.DataFileMissing
- GPload.Exception.DelimiterMissing
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/df7f9c12f1f14104.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkDataOutput.java:119
StringBuffer buf = new StringBuffer( orig );
Const.repl( buf, enclosure, enclosure + enclosure );
return buf.toString();
}
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" );
}
// Write the data to the output
ValueMetaInterface v = null;
int number = 0;
for ( int i = 0; i < fieldNumbers.length; i++ ) {
if ( i != 0 ) {
output.print( "," );
}
number = fieldNumbers[i];
v = mi.getValueMeta( number );
if ( row[number] == null ) {
// TODO (SB): special check for null in case of Strings.View on GitHub (pinned to f3058517a1)