pentaho/pentaho-kettle · error · KettleException

There is no input field specified for stats calc #

Error message

There is no input field specified for stats calc #{0}

What it means

Each UnivariateStats calc entry must reference an input field. In processRow, if a UnivariateStatsMetaFunction has an empty/null sourceFieldName (so no field lookup was performed), the step throws this KettleException for that calc index instead of computing stats.

Solutions

  1. Open the UnivariateStats step dialog and set a source field for every listed stats calc
  2. Delete empty/unneeded stats calc rows from the configuration
  3. Re-save the transformation after fixing the step
  4. Validate the step config via the step's check results in Spoon

Example fix

// before (empty calc entry)
new UnivariateStatsMetaFunction( null, ... )
// after
new UnivariateStatsMetaFunction( "amount", ... )
Defensive patterns

Strategy: validation

Validate before calling

// Java: reject empty source fields in the step config before running
for ( UnivariateStatsMetaFunction f : meta.getFieldDefs() ) {
  if ( Utils.isEmpty( f.getSourceFieldName() ) ) {
    throw new IllegalStateException( "UnivariateStats calc has no source field configured" );
  }
}

Type guard

boolean hasSourceField(UnivariateStatsMetaFunction f) {
  return f != null && !Utils.isEmpty( f.getSourceFieldName() );
}

Try / catch

try {
  trans.execute( null );
} catch ( KettleException e ) {
  if ( e.getMessage().contains( "no input field specified" ) ) {
    // remove or complete the empty stats calc entry
  }
  throw e;
}

Prevention

When it happens

Trigger: processRow's first-pass initialization reaches a configured stats calc whose sourceFieldName is empty — i.e. a stats definition row exists in the step config with no source field selected.

Common situations: A stats line was added in the step dialog but no field was chosen; a field was later removed leaving a blank entry; config migrated from another transformation losing field names.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/univariatestats/UnivariateStats.java:159

          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;

          // set up caches if median/percentiles have been
          // requested

          if ( usmf.getCalcMedian() || usmf.getCalcPercentile() >= 0 ) {
            m_dataCache[ i ] = new ArrayList<Number>();
          }
        } else {
          throw new KettleException( "There is no input field specified for stats calc #" + ( i + 1 ) );
        }
      }
    } // end (if first)

    for ( int i = 0; i < m_meta.getNumFieldsToProcess(); i++ ) {

      UnivariateStatsMetaFunction usmf = m_meta.getInputFieldMetaFunctions()[ i ];
      if ( !Utils.isEmpty( usmf.getSourceFieldName() ) ) {
        FieldIndex tempData = m_data.getFieldIndexes()[ i ];

        ValueMetaInterface metaI = getInputRowMeta().getValueMeta( tempData.m_columnIndex );

        Number input = null;
        try {
          input = metaI.getNumber( r[ tempData.m_columnIndex ] );
        } catch ( Exception ex ) {
          // quietly ignore -- assume missing for anything not
          // parsable as a number

View on GitHub (pinned to f3058517a1)