pentaho/pentaho-kettle · error · RuntimeException
Wrong value conversion to
Error message
Wrong value conversion to
What it means
getStringAsJavaType() converts a String value to a requested Java type via an InjectionTypeConverter during metadata injection. If destinationType is not one of the supported targets (String primitives, Boolean, enums, etc.), it throws a RuntimeException naming the type. It's a fail-fast guard for unsupported injection target types.
Solutions
- Change the target property's Java type to a supported one (String, boolean/Boolean, int/Integer, enum)
- Register/extend the InjectionTypeConverter to support the destination type
- Convert the value manually before injection (e.g. pre-parse the string to the needed type)
- Catch RuntimeException around the injection call and report the unsupported type
Example fix
// before
injection.setProperty("format", someDate, Date.class);
// after
injection.setProperty("format", someDate, String.class); Defensive patterns
Strategy: type-guard
Validate before calling
boolean isSupportedStringDestination(Class<?> t) {
return String.class.isAssignableFrom(t) || t == boolean.class || Boolean.class.isAssignableFrom(t)
|| (t.isEnum());
} Type guard
boolean isSupportedStringDestination(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("Unsupported destination type " + destType + " for field " + name, e);
} else throw e;
} Prevention
- Map injection targets only to String, boolean/Boolean, int/Integer, and enum destination types
- Keep step setter types aligned with converter capabilities
- Write a unit test that injects every mapped field with its declared type
When it happens
Trigger: Calling getAsJavaType (via setProperty) with a destinationType that falls through all isAssignableFrom checks in getStringAsJavaType — e.g. a non-String source field being injected into a destination type like Date, Map, List, or a primitive other than the supported ones.
Common situations: Metadata injection into a step whose setter expects a type (e.g. java.util.Date, BigDecimal, array) that the converter has no string conversion for; changing a field's Java type in a custom step without updating injection support.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unknown conversion from
- Unknown source type:
- Unknown value for enum
- Wrong value conversion to
- : can't be converted to an Internet Address
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/dc1ed4b8fb8fb05e.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/RowMetaAndData.java:337
throws KettleValueException {
if ( String.class.isAssignableFrom( destinationType ) ) {
return converter.string2string( vs );
} else if ( int.class.isAssignableFrom( destinationType ) ) {
return converter.string2intPrimitive( vs );
} else if ( Integer.class.isAssignableFrom( destinationType ) ) {
return converter.string2integer( vs );
} else if ( long.class.isAssignableFrom( destinationType ) ) {
return converter.string2longPrimitive( vs );
} else if ( Long.class.isAssignableFrom( destinationType ) ) {
return converter.string2long( vs );
} else if ( boolean.class.isAssignableFrom( destinationType ) ) {
return converter.string2booleanPrimitive( vs );
} else if ( Boolean.class.isAssignableFrom( destinationType ) ) {
return converter.string2boolean( vs );
} else if ( destinationType.isEnum() ) {
return converter.string2enum( destinationType, vs );
} else {
throw new RuntimeException( "Wrong value conversion to " + destinationType );
}
}
/**
* Returns value as specified java type using converter. Used for metadata injection.
*/
public Object getAsJavaType( String valueName, Class<?> destinationType, InjectionTypeConverter converter )
throws KettleValueException {
int idx = rowMeta.indexOfValue( valueName );
if ( idx < 0 ) {
throw new KettleValueException( "Unknown column '" + valueName + "'" );
}
ValueMetaInterface metaType = rowMeta.getValueMeta( idx );
// find by source value type
switch ( metaType.getType() ) {
case ValueMetaInterface.TYPE_STRING:
String vs = rowMeta.getString( data, idx );View on GitHub (pinned to f3058517a1)