pentaho/pentaho-kettle · error · EvaluationException
ERROR_ARITHMETIC_VALUE
ERROR_ARITHMETIC_VALUE
Error message
ERROR_ARITHMETIC_VALUE (arithmetic error converting row value)
What it means
In resolveReference, the formula engine reads a row value and converts it to a Java primitive via getPrimitive(). If the ValueMeta conversion fails (KettleValueException), the step wraps it in an EvaluationException carrying ERROR_ARITHMETIC_VALUE, meaning the referenced field's value could not be arithmetically/type converted for formula evaluation. This is the generic 'value conversion failed' signal in the formula (libformula) engine.
Solutions
- Inspect the referenced field's actual data at runtime; clean or coerce invalid values upstream (e.g. with a Calculator/Value Mapper or IF in the formula itself).
- Verify the ValueMeta type of the field matches how the formula uses it; add an explicit conversion step before the Formula step.
- Wrap formula operand usage defensively, e.g. IF(ISBLANK([field]);0;[field]) or use string-safe functions before numeric operations.
- Check upstream steps for type changes after a version migration or step reconfiguration.
Example fix
// before (formula assumes numeric) [field] * 2 // after (guard against non-numeric) IF(ISBLANK([field]) OR ISNUMBER([field]) = FALSE; 0; [field] * 2)
Defensive patterns
Strategy: validation
Validate before calling
// Before the Formula step, verify field type and data:
ValueMetaInterface vm = inputRowMeta.searchValueMeta(fieldName);
if (vm == null || !(vm.getType() == ValueMetaInterface.TYPE_NUMBER || vm.getType() == ValueMetaInterface.TYPE_INTEGER)) {
throw new KettleException("Field " + fieldName + " is not numeric: " + vm);
} Type guard
boolean isNumeric(ValueMetaInterface vm) {
return vm != null && (vm.isNumeric());
} Prevention
- Preview upstream data to confirm values are convertible to the expected type.
- Keep field types stable across steps; add explicit conversion steps.
- Use formula guards like IFERROR/ISNUMBER before arithmetic.
- Avoid feeding binary or loosely-typed fields into formulas.
When it happens
Trigger: A formula references a field whose stored value cannot be converted to the primitive type the formula expects, and ValueMeta.getNativeObject/getPrimitive throws KettleValueException — e.g. reading a non-numeric string as Number, malformed Date, or binary value used in arithmetic.
Common situations: Formula step references a column containing 'N/A' or empty-but-not-null strings used in numeric expressions; upstream step changed a field's type (e.g. Integer to String); locale/date format mismatches when converting string values to dates; binary/large-object fields pulled into formulas.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- : can't be converted to an Internet Address
- Error converting data while looking up value
- : I don't know how to convert a binary value to Internet…
- : I don't know how to convert a binary value to timestamp.
- : I don't know how to convert a boolean to a Internet…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/35013662ddfe4ae3.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/formula/RowForumulaContext.java:97
ValueMetaInterface valueMeta;
Integer idx = valueIndexMap.get( name );
if ( idx != null ) {
valueMeta = rowMeta.getValueMeta( idx.intValue() );
} else {
int index = rowMeta.indexOfValue( (String) name );
if ( index < 0 ) {
ErrorValue errorValue = new LibFormulaErrorValue( LibFormulaErrorValue.ERROR_INVALID_ARGUMENT );
throw new EvaluationException( errorValue );
}
valueMeta = rowMeta.getValueMeta( index );
idx = new Integer( index );
valueIndexMap.put( (String) name, idx );
}
Object valueData = rowData[idx];
try {
return getPrimitive( valueMeta, valueData );
} catch ( KettleValueException e ) {
throw new EvaluationException( LibFormulaErrorValue.ERROR_ARITHMETIC_VALUE );
}
}
return null;
}
public Configuration getConfiguration() {
return formulaContext.getConfiguration();
}
public FunctionRegistry getFunctionRegistry() {
return formulaContext.getFunctionRegistry();
}
public LocalizationContext getLocalizationContext() {
return formulaContext.getLocalizationContext();
}
public OperatorFactory getOperatorFactory() {View on GitHub (pinned to f3058517a1)