pentaho/pentaho-kettle · error · KettleStepException
There is no first argument specified for calculated field #
Error message
There is no first argument specified for calculated field #{0} What it means
Every calculation that references a first argument must actually specify one: if function.getFieldA() is empty/null and the calc type is not CALC_CONSTANT, processRow throws KettleStepException 'There is no first argument specified for calculated field #N'. This is a configuration completeness check distinct from the field-not-found check.
Solutions
- Set the 'First argument field' for calculation #N in the Calculator dialog
- Switch the calculation type to a constant or one-argument type if field A is genuinely not needed
- Remove the incomplete calculation row
Example fix
// before
fn = new CalculatorMetaFunction("total", CALC_SUM, null, "b", null, ...); // fieldA missing
// after
fn = new CalculatorMetaFunction("total", CALC_SUM, "a", "b", null, ...); Defensive patterns
Strategy: validation
Validate before calling
if (fn.getCalcType() != CALC_CONSTANT && Utils.isEmpty(fn.getFieldA()))
throw new IllegalArgumentException("Calc # requires a first argument"); Try / catch
catch (KettleStepException e) { if (e.getMessage().contains("no first argument")) { /* set fieldA or change calc type */ } throw e; } Prevention
- Match the number of arguments to the chosen calculation type (A, A+B, A+B+C)
- Use CALC_CONSTANT only when supplying a constant value
- Review the Calculator grid for blank argument cells before saving
When it happens
Trigger: processRow init: a calculation type that requires field A (any non-constant type) has an empty getFieldA().
Common situations: Choosing a two-argument calculation (e.g. A+B, A-B) but leaving the first argument blank in the dialog; building meta programmatically and omitting fieldA.
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
- Calculator.Error.NoNameField
- Calculator.Error.UnableFindField
- Calculator.ErrorInStepRunning
- Calculator.Log.NoType + ( i + 1 ) + " : " + fieldName + " =…
- Calculator.Log.UnknownCalculationType + fn.getCalcType()
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/df9eb47ce200cc0f.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java:117
}
} else {
throw new KettleStepException( BaseMessages.getString( PKG, "Calculator.Error.NoNameField", ""
+ ( i + 1 ) ) );
}
if ( !Utils.isEmpty( function.getFieldA() ) ) {
if ( function.getCalcType() != CalculatorMetaFunction.CALC_CONSTANT ) {
data.getFieldIndexes()[i].indexA = data.getCalcRowMeta().indexOfValue( function.getFieldA() );
if ( data.getFieldIndexes()[i].indexA < 0 ) {
// Nope: throw an exception
throw new KettleStepException( "Unable to find the first argument field '"
+ function.getFieldName() + " for calculation #" + ( i + 1 ) );
}
} else {
data.getFieldIndexes()[i].indexA = -1;
}
} else {
throw new KettleStepException( "There is no first argument specified for calculated field #" + ( i + 1 ) );
}
if ( !Utils.isEmpty( function.getFieldB() ) ) {
data.getFieldIndexes()[i].indexB = data.getCalcRowMeta().indexOfValue( function.getFieldB() );
if ( data.getFieldIndexes()[i].indexB < 0 ) {
// Nope: throw an exception
throw new KettleStepException( "Unable to find the second argument field '"
+ function.getFieldName() + " for calculation #" + ( i + 1 ) );
}
}
data.getFieldIndexes()[i].indexC = -1;
if ( !Utils.isEmpty( function.getFieldC() ) ) {
data.getFieldIndexes()[i].indexC = data.getCalcRowMeta().indexOfValue( function.getFieldC() );
if ( data.getFieldIndexes()[i].indexC < 0 ) {
// Nope: throw an exception
throw new KettleStepException( "Unable to find the third argument field '"
+ function.getFieldName() + " for calculation #" + ( i + 1 ) );
}View on GitHub (pinned to f3058517a1)