pentaho/pentaho-kettle · error · KettleValueException
Function STR2NUM works only on strings
Error message
Function STR2NUM works only on strings
What it means
Guard at the top of the legacy Value str2num() function: the value being converted is not of String type, so the string-to-number parser refuses to run. The input at fault is the current Value whose type is not VALUE_TYPE_STRING.
Solutions
- Ensure the field passed to STR2NUM is a String
- Convert the value to String first if it originates from another type
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at core/src/main/java/org/pentaho/di/compatibility/Value.java:3242 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/3f3681d6588af4b3.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/compatibility/Value.java:3242
} catch ( Exception e ) {
String message = "Couldn't convert string to number " + e.toString();
if ( !Utils.isEmpty( pattern ) ) {
message += " pattern=" + pattern;
}
if ( !Utils.isEmpty( decimal ) ) {
message += " decimal=" + decimal;
}
if ( !Utils.isEmpty( grouping ) ) {
message += " grouping=" + grouping.charAt( 0 );
}
if ( !Utils.isEmpty( currency ) ) {
message += " currency=" + currency;
}
throw new KettleValueException( message );
}
}
} else {
throw new KettleValueException( "Function STR2NUM works only on strings" );
}
}
return this;
}
public Value dat2num() throws KettleValueException {
if ( isNull() ) {
setType( VALUE_TYPE_INTEGER );
return this;
}
if ( getType() == VALUE_TYPE_DATE ) {
if ( getString() == null ) {
setNull();
setValue( 0L );
} else {
setValue( getInteger() );
}View on GitHub (pinned to f3058517a1)