pentaho/pentaho-kettle · error · KettleStepException
Unable to find the specified fieldname
Error message
Unable to find the specified fieldname '{0}' for stats calc #{1} What it means
The UnivariateStats step computes statistics (mean, median, stddev, etc.) over configured input fields. During processRow initialization it looks up each stats definition's source field in the incoming row metadata; if indexOfValue returns -1 the step aborts with this KettleStepException naming the missing field and calc index.
Solutions
- Open the UnivariateStats step and verify each stats calc's source field name against the incoming stream
- Use the 'Get fields' button in the step dialog to re-populate valid field names
- Fix or add the upstream step that should produce the field
- Re-check the hop is connected to the step that emits the field
Example fix
// before (config referencing removed field) sourceFieldName="amount_old" // after sourceFieldName="amount"
Defensive patterns
Strategy: validation
Validate before calling
// Java: verify configured source fields exist in the incoming stream before running
RowMetaInterface input = transMeta.getPrevStepFields( univariateStatsStepMeta );
for ( UnivariateStatsMetaFunction f : meta.getFieldDefs() ) {
if ( !Utils.isEmpty( f.getSourceFieldName() ) && input.indexOfValue( f.getSourceFieldName() ) < 0 ) {
throw new IllegalStateException( "Field " + f.getSourceFieldName() + " not in input stream" );
}
} Type guard
boolean fieldExists(RowMetaInterface rowMeta, String name) {
return rowMeta != null && name != null && rowMeta.indexOfValue( name ) >= 0;
} Try / catch
try {
trans.execute( null );
} catch ( KettleStepException e ) {
if ( e.getMessage().startsWith( "Unable to find the specified fieldname" ) ) {
// fix the UnivariateStats field configuration
}
throw e;
} Prevention
- Use 'Get fields' in the step dialog instead of typing field names
- Re-check step configs after renaming upstream fields
- Run Spoon's step check results before executing
When it happens
Trigger: processRow (first pass) finds a UnivariateStatsMetaFunction whose sourceFieldName is non-empty but absent from m_data.getInputRowMeta() — i.e. the configured field is not produced by the preceding step.
Common situations: Upstream step renamed or removed the field; field name typo in the step config; transformation edited so the field no longer flows into UnivariateStats.
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
- AutoDoc.Exception.FilenameFieldNotFound
- AutoDoc.Exception.FileTypeFieldNotFound
- ScriptValuesMetaMod.Exception.FieldToReplaceNotFound
- All input files need to have the same number of fields. File
- AnalyticQueryMeta.Exception.SubjectFieldNotFound
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/ec60cc1d00b34c50.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/univariatestats/UnivariateStats.java:133
// Initialize the step meta data
FieldIndex[] fi = new FieldIndex[ m_meta.getNumFieldsToProcess() ];
m_data.setFieldIndexes( fi );
// allocate the field indexes in the data class and meta stats functions
// in the step meta
for ( int i = 0; i < m_meta.getNumFieldsToProcess(); i++ ) {
UnivariateStatsMetaFunction usmf = m_meta.getInputFieldMetaFunctions()[ i ];
//CHECKSTYLE:Indentation:OFF
m_data.getFieldIndexes()[ i ] = new FieldIndex();
// check that this univariate stats computation has been
// defined on an input field
if ( !Utils.isEmpty( usmf.getSourceFieldName() ) ) {
int fieldIndex = m_data.getInputRowMeta().indexOfValue( usmf.getSourceFieldName() );
if ( fieldIndex < 0 ) {
throw new KettleStepException( "Unable to find the specified fieldname '"
+ usmf.getSourceFieldName() + "' for stats calc #" + ( i + 1 ) );
}
FieldIndex tempData = m_data.getFieldIndexes()[ i ];
tempData.m_columnIndex = fieldIndex;
ValueMetaInterface inputFieldMeta = m_data.getInputRowMeta().getValueMeta( fieldIndex );
// check the type of the input field
if ( !inputFieldMeta.isNumeric() ) {
throw new KettleException( "The input field for stats calc #" + ( i + 1 ) + "is not numeric." );
}
// finish initializing
tempData.m_min = Double.MAX_VALUE;
tempData.m_max = Double.MIN_VALUE;
View on GitHub (pinned to f3058517a1)