pentaho/pentaho-kettle · error · KettleException
GetFilesRowsCount.Exception.CouldnotFindField
Error message
GetFilesRowsCount.Exception.CouldnotFindField
What it means
GetFilesRowsCount.openNextFile() throws this KettleException (bundle key GetFilesRowsCount.Exception.CouldnotFindField) when the configured output filename field does not exist in the incoming row meta — indexOfValue returns -1. The step cannot read the file name from the row, so processing stops.
Solutions
- Correct the 'filename field name' in the step dialog to match an actual incoming field.
- Check field names (and case) coming from the previous step via 'Preview'.
- Add or restore the field upstream if it was removed.
- Validate metadata with 'Verify transformations' before running.
Example fix
// before
meta.setOutputFilenameField("Filename"); // incoming field is "filename"
// after
meta.setOutputFilenameField("filename"); // matches input row meta exactly Defensive patterns
Strategy: validation
Validate before calling
String field = meta.setOutputFilenameField(); if (prevStreamRowMeta.indexOfValue(field) < 0) throw new IllegalArgumentException("Field not found in input rows: " + field); Try / catch
try { transMeta.execute(...); } catch (KettleException e) { if (e.getMessage().contains("CouldnotFindField")) { /* correct the configured field name to match upstream */ } throw e; } Prevention
- Use step Preview to confirm exact field names (case included)
- Keep field names in sync when refactoring upstream steps
- Rename fields at the source rather than guessing
- Run metadata verification before production runs
When it happens
Trigger: On the first row, getInputRowMeta().indexOfValue(meta.setOutputFilenameField()) returns -1 because the field name configured on the step does not match any field produced by the previous step.
Common situations: Upstream step renamed or removed the field; case mismatch between configured name and actual field; inserting this step after a different source than originally designed.
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
- Couldn't find field ' ' in row!
- FieldsChangeSequence.Log.CanNotFindField
- LDIFInput.Exception.CouldnotFindField
- LoadFileInput.Exception.CouldnotFindField
- Unable to find field [
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/c4c5cb6e2a49f44b.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCount.java:234
metaStore );
// Get total previous fields
data.totalpreviousfields = data.inputRowMeta.size();
// Check is filename field is provided
if ( Utils.isEmpty( meta.setOutputFilenameField() ) ) {
logError( BaseMessages.getString( PKG, "GetFilesRowsCount.Log.NoField" ) );
throw new KettleException( BaseMessages.getString( PKG, "GetFilesRowsCount.Log.NoField" ) );
}
// cache the position of the field
if ( data.indexOfFilenameField < 0 ) {
data.indexOfFilenameField = getInputRowMeta().indexOfValue( meta.setOutputFilenameField() );
if ( data.indexOfFilenameField < 0 ) {
// The field is unreachable !
logError( BaseMessages.getString( PKG, "GetFilesRowsCount.Log.ErrorFindingField", meta
.setOutputFilenameField() ) );
throw new KettleException( BaseMessages.getString(
PKG, "GetFilesRowsCount.Exception.CouldnotFindField", meta.setOutputFilenameField() ) );
}
}
} // End if first
String filename = getInputRowMeta().getString( data.readrow, data.indexOfFilenameField );
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "GetFilesRowsCount.Log.FilenameInStream", meta
.setOutputFilenameField(), filename ) );
}
data.file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( filename, getTransMeta() );
// Init Row number
if ( meta.isFileField() ) {
data.rownr = 0;
}View on GitHub (pinned to f3058517a1)