pentaho/pentaho-kettle · error · KettleValueException

resultType: " + resultType + "; targetMeta: " +…

Error message

resultType: " + resultType + "; targetMeta: " + targetMeta.getType()

What it means

After calculating a value, Calculator converts it from the internal result type to the field's target type via targetMeta.convertData. Any exception there is wrapped in a KettleValueException whose message concatenates resultType and targetMeta.getType(), with the original exception as cause.

Solutions

  1. Read the chained cause exception for the exact parse/conversion failure
  2. Fix the Calculator field's target type or conversion mask to match the actual data format
  3. Set correct decimal/grouping/currency symbols on the field definition
  4. Pre-normalize the input value (e.g. via a Select Values / String operations step) before the Calculator

Example fix

// before
Fieldname: amount, Calculator fn: A+B, Type: Number, ConversionMask: #,##0.00
// data is '1.234,56' with default US symbols
// after
Set Decimal symbol: ',' and Grouping symbol: '.' on the Calculator field
Defensive patterns

Strategy: try-catch

Validate before calling

// check the target type can hold the calculation result
if (!isCompatible(calcResultType(fn), targetMeta.getType()))
  logError("Type mismatch for calculator field " + fn.getFieldName());

Type guard

boolean isNumeric(ValueMetaInterface vm) {
  return vm != null && (vm.isNumber() || vm.isInteger() || vm.isBigNumber());
}

Try / catch

try { calcData[index] = targetMeta.convertData(resultMeta, calcData[index]); }
catch (Exception ex) { throw new KettleValueException("Cannot convert " + resultType + " to " + targetMeta.getType(), ex); }

Prevention

When it happens

Trigger: calcData[index] holds a value of internal type resultType that cannot be converted to the target field's type (targetMeta.getType()), e.g. string that is not a number, or null/formatting incompatibility.

Common situations: Conversion mask mismatching data ('yyyy-MM-dd' vs 'dd/MM/yyyy'), non-numeric strings converted to Number via concatenation functions, locale/decimal-symbol settings that don't match the data.

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


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/calculator/Calculator.java:642

        // Convert the data to the correct target data type.
        //
        if ( calcData[index] != null ) {
          if ( targetMeta.getType() != resultType ) {
            ValueMetaInterface resultMeta;
            try {
              // clone() is not necessary as one data instance belongs to one step instance and no race condition occurs
              resultMeta = data.getValueMetaFor( resultType, "result" );
            } catch ( Exception exception ) {
              throw new KettleValueException( "Error creating value" );
            }
            resultMeta.setConversionMask( fn.getConversionMask() );
            resultMeta.setGroupingSymbol( fn.getGroupingSymbol() );
            resultMeta.setDecimalSymbol( fn.getDecimalSymbol() );
            resultMeta.setCurrencySymbol( fn.getCurrencySymbol() );
            try {
              calcData[index] = targetMeta.convertData( resultMeta, calcData[index] );
            } catch ( Exception ex ) {
              throw new KettleValueException( "resultType: "
                + resultType + "; targetMeta: " + targetMeta.getType(), ex );
            }
          }
        }
      }
    }

    // OK, now we should refrain from adding the temporary fields to the result.
    // So we remove them.
    //
    return RowDataUtil.removeItems( calcData, data.getTempIndexes() );
  }

  @Override
  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
    meta = (CalculatorMeta) smi;
    data = (CalculatorData) sdi;

View on GitHub (pinned to f3058517a1)