pentaho/pentaho-kettle · error · KettleValueException

Error creating value

Error message

Error creating value

What it means

Calculator's calcFields wraps any exception thrown while obtaining the internal ValueMeta cache entry for the computed result type (data.getValueMetaFor) as a KettleValueException with the generic message 'Error creating value'. This is an internal metadata-construction failure, not a data error; the actual cause is hidden because the exception is not chained.

Solutions

  1. Enable detailed/developer logging or debug the step to see the suppressed cause inside the wrapped exception
  2. Verify each Calculator field's conversion mask/decimal/currency/grouping symbols are valid for the chosen target type
  3. Recreate the Calculator step metadata (copy fields into a fresh step) to clear stale/invalid settings
  4. Upgrade/patch Kettle engine if the result type is known-valid but getValueMetaFor still fails
Defensive patterns

Strategy: validation

Validate before calling

// before running the transformation, verify Calculator result types are buildable
for (CalculatorMetaFunction fn : meta.getCalculation()) {
  if (fn.getCalcType() < 0 || fn.getFieldName() == null)
    throw new IllegalStateException("Invalid calculator function definition: " + fn);
}

Type guard

boolean isValidFunction(CalculatorMetaFunction fn) {
  return fn != null && fn.getFieldName() != null && fn.getCalcType() >= 0;
}

Try / catch

try { row = calcFields(...); } catch (KettleValueException e) {
  logError("Calculator value creation failed on field " + fn.getFieldName(), e);
  throw e;
}

Prevention

When it happens

Trigger: calcFields computes a field whose resultType has no (or an invalid) combination of value-meta type and conversion settings such that the ValueMeta factory throws, while processing a row through the Calculator step.

Common situations: Calculator functions producing exotic result types (e.g. arithmetic producing BigNumber/String combos), corrupted step metadata after upgrade, or a Kettle version where ValueMeta construction for a type is unsupported.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

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

        // If we don't have a target data type, throw an error.
        // Otherwise the result is non-deterministic.
        //
        if ( targetMeta.getType() == ValueMetaInterface.TYPE_NONE ) {
          throw new KettleValueException( BaseMessages.getString( PKG, "Calculator.Log.NoType" )
            + ( i + 1 ) + " : " + fn.getFieldName() + " = " + fn.getCalcTypeDesc() + " / "
            + fn.getCalcTypeLongDesc() );
        }

        // 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.

View on GitHub (pinned to f3058517a1)