pentaho/pentaho-kettle · error · KettleStepException
Unable to find the third argument field
Error message
Unable to find the third argument field '{0} for calculation #{1} What it means
For calculations that use a third argument (e.g. IsNA(a,b,c), NVL-like functions), Calculator resolves fieldC against the input row metadata. If fieldC is non-empty but indexOfValue returns < 0, processRow throws KettleStepException 'Unable to find the third argument field ... for calculation #N'.
Solutions
- Correct 'Third argument field' in calculation #N to an existing input field
- Clear field C if the calculation type does not actually need it
- Preview the upstream step and re-pick the field name
Example fix
// before
fn.setFieldC("default_val"); // upstream field is "defaultValue"
// after
fn.setFieldC("defaultValue"); Defensive patterns
Strategy: validation
Validate before calling
if (!Utils.isEmpty(fn.getFieldC()) && calcRowMeta.indexOfValue(fn.getFieldC()) < 0)
throw new IllegalArgumentException("Calc fieldC not in input: " + fn.getFieldC()); Try / catch
catch (KettleStepException e) { /* open the calculation named in the message and fix field C */ throw e; } Prevention
- Only populate field C for three-argument calculation types
- Confirm upstream still emits the field used as the third argument
- Preview input rows before running the full transformation
When it happens
Trigger: processRow init: function.getFieldC() is set but the named field is absent from data.getCalcRowMeta().
Common situations: Three-argument calculations (e.g. IF/round with precision) referencing a field that was renamed or filtered out upstream; typo in the 'Third argument field' box.
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
- Calculator.Error.UnableFindField
- Unable to find the first argument field
- Unable to find the second argument field
- Calculator.Error.NoNameField
- Calculator.ErrorInStepRunning
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/d819306274f709be.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java:133
}
} 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 ) );
}
}
if ( function.isRemovedFromResult() ) {
tempIndexes.add( getInputRowMeta().size() + i );
}
}
// Convert temp indexes to int[]
data.setTempIndexes( new int[tempIndexes.size()] );
for ( int i = 0; i < data.getTempIndexes().length; i++ ) {
data.getTempIndexes()[i] = tempIndexes.get( i );
}
}
if ( log.isRowLevel() ) {
logRowlevel( BaseMessages.getString( PKG, "Calculator.Log.ReadRow" )View on GitHub (pinned to f3058517a1)