{"record":{"id":"67abbb4eae3b594c","repo":"pentaho/pentaho-kettle","slug":"there-is-no-input-field-specified-for-stats-calc-0","errorCode":null,"errorMessage":"There is no input field specified for stats calc #{0}","messagePattern":"There is no input field specified for stats calc #(.+?)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/univariatestats/UnivariateStats.java","lineNumber":159,"sourceCode":"          ValueMetaInterface inputFieldMeta = m_data.getInputRowMeta().getValueMeta( fieldIndex );\n\n          // check the type of the input field\n          if ( !inputFieldMeta.isNumeric() ) {\n            throw new KettleException( \"The input field for stats calc #\" + ( i + 1 ) + \"is not numeric.\" );\n          }\n\n          // finish initializing\n          tempData.m_min = Double.MAX_VALUE;\n          tempData.m_max = Double.MIN_VALUE;\n\n          // set up caches if median/percentiles have been\n          // requested\n\n          if ( usmf.getCalcMedian() || usmf.getCalcPercentile() >= 0 ) {\n            m_dataCache[ i ] = new ArrayList<Number>();\n          }\n        } else {\n          throw new KettleException( \"There is no input field specified for stats calc #\" + ( i + 1 ) );\n        }\n      }\n    } // end (if first)\n\n    for ( int i = 0; i < m_meta.getNumFieldsToProcess(); i++ ) {\n\n      UnivariateStatsMetaFunction usmf = m_meta.getInputFieldMetaFunctions()[ i ];\n      if ( !Utils.isEmpty( usmf.getSourceFieldName() ) ) {\n        FieldIndex tempData = m_data.getFieldIndexes()[ i ];\n\n        ValueMetaInterface metaI = getInputRowMeta().getValueMeta( tempData.m_columnIndex );\n\n        Number input = null;\n        try {\n          input = metaI.getNumber( r[ tempData.m_columnIndex ] );\n        } catch ( Exception ex ) {\n          // quietly ignore -- assume missing for anything not\n          // parsable as a number","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/univariatestats/UnivariateStats.java#L141-L177","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the UnivariateStats step dialog and set a source field for every listed stats calc","Delete empty/unneeded stats calc rows from the configuration","Re-save the transformation after fixing the step","Validate the step config via the step's check results in Spoon"],"exampleFix":"// before (empty calc entry)\nnew UnivariateStatsMetaFunction( null, ... )\n// after\nnew UnivariateStatsMetaFunction( \"amount\", ... )","handlingStrategy":"validation","validationCode":"// Java: reject empty source fields in the step config before running\nfor ( UnivariateStatsMetaFunction f : meta.getFieldDefs() ) {\n  if ( Utils.isEmpty( f.getSourceFieldName() ) ) {\n    throw new IllegalStateException( \"UnivariateStats calc has no source field configured\" );\n  }\n}","typeGuard":"boolean hasSourceField(UnivariateStatsMetaFunction f) {\n  return f != null && !Utils.isEmpty( f.getSourceFieldName() );\n}","tryCatchPattern":"try {\n  trans.execute( null );\n} catch ( KettleException e ) {\n  if ( e.getMessage().contains( \"no input field specified\" ) ) {\n    // remove or complete the empty stats calc entry\n  }\n  throw e;\n}","preventionTips":["Never leave stats calc rows without a selected field in the dialog","Remove obsolete calc entries after field renames","Use step check results in Spoon to catch blank configs pre-run"],"tags":["kettle","missing-field","configuration","univariate-stats"],"backgroundTag":"missing-required-argument","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}