pentaho/pentaho-kettle · error · RuntimeException

Wrong value conversion to

Error message

Wrong value conversion to <destinationType>

What it means

In getAsJavaType(), when the source field is a Boolean (TYPE_BOOLEAN), all supported destination conversions (String, boolean primitive, Boolean, enum) are tried via the converter; if destinationType matches none, a RuntimeException 'Wrong value conversion to <type>' is thrown. It's the per-type fallthrough guard for unsupported target types.

Solutions

  1. Change the destination property type to a supported one (String, boolean/Boolean, enum)
  2. Extend the InjectionTypeConverter with a boolean2X conversion for the needed type
  3. Change the source field type (e.g. encode the boolean as 0/1 integer) to match the target
  4. Catch RuntimeException and report which field/type combination is unsupported

Example fix

// before
row.getAsJavaType("flag", int.class, converter); // boolean source
// after
row.getAsJavaType("flag", Boolean.class, converter);
Defensive patterns

Strategy: type-guard

Validate before calling

if (row.getRowMeta().getValueMeta(idx).getType() == ValueMetaInterface.TYPE_BOOLEAN) {
  if (!(String.class.isAssignableFrom(destType) || destType == boolean.class
      || Boolean.class.isAssignableFrom(destType) || destType.isEnum())) {
    throw new IllegalArgumentException("Unsupported boolean destination: " + destType);
  }
}

Type guard

boolean isSupportedBooleanDestination(Class<?> t) {
  return String.class.isAssignableFrom(t) || t == boolean.class
    || Boolean.class.isAssignableFrom(t) || t.isEnum();
}

Try / catch

try {
  Object v = row.getAsJavaType(name, destType, converter);
} catch (RuntimeException e) {
  if (e.getMessage().startsWith("Wrong value conversion")) {
    log.error("Boolean field " + name + " cannot convert to " + destType, e);
  } else throw e;
}

Prevention

When it happens

Trigger: Injecting a Boolean source field into a destinationType like int, Double, Date, Map, or any class not supported by boolean2* converter methods.

Common situations: Metadata injection where step property type changed between Kettle versions (e.g. from boolean to int) and the mapping still injects booleans; injecting into custom step setters with unsupported types.

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/38525defc7e3a5de. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/core/RowMetaAndData.java:376

        Boolean vb = rowMeta.getBoolean( data, idx );
        if ( String.class.isAssignableFrom( destinationType ) ) {
          return converter.boolean2string( vb );
        } else if ( int.class.isAssignableFrom( destinationType ) ) {
          return converter.boolean2intPrimitive( vb );
        } else if ( Integer.class.isAssignableFrom( destinationType ) ) {
          return converter.boolean2integer( vb );
        } else if ( long.class.isAssignableFrom( destinationType ) ) {
          return converter.boolean2longPrimitive( vb );
        } else if ( Long.class.isAssignableFrom( destinationType ) ) {
          return converter.boolean2long( vb );
        } else if ( boolean.class.isAssignableFrom( destinationType ) ) {
          return converter.boolean2booleanPrimitive( vb );
        } else if ( Boolean.class.isAssignableFrom( destinationType ) ) {
          return converter.boolean2boolean( vb );
        } else if ( destinationType.isEnum() ) {
          return converter.boolean2enum( destinationType, vb );
        } else {
          throw new RuntimeException( "Wrong value conversion to " + destinationType );
        }
      case ValueMetaInterface.TYPE_INTEGER:
        Long vi = rowMeta.getInteger( data, idx );
        if ( String.class.isAssignableFrom( destinationType ) ) {
          return converter.integer2string( vi );
        } else if ( int.class.isAssignableFrom( destinationType ) ) {
          return converter.integer2intPrimitive( vi );
        } else if ( Integer.class.isAssignableFrom( destinationType ) ) {
          return converter.integer2integer( vi );
        } else if ( long.class.isAssignableFrom( destinationType ) ) {
          return converter.integer2longPrimitive( vi );
        } else if ( Long.class.isAssignableFrom( destinationType ) ) {
          return converter.integer2long( vi );
        } else if ( boolean.class.isAssignableFrom( destinationType ) ) {
          return converter.integer2booleanPrimitive( vi );
        } else if ( Boolean.class.isAssignableFrom( destinationType ) ) {
          return converter.integer2boolean( vi );
        } else if ( destinationType.isEnum() ) {

View on GitHub (pinned to f3058517a1)