{"record":{"id":"3eca5dbd25abc706","repo":"pentaho/pentaho-kettle","slug":"couldn-t-convert-string-to-number","errorCode":null,"errorMessage":"Couldn't convert string to number ","messagePattern":"Couldn't convert string to number ","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/compatibility/Value.java","lineNumber":3238,"sourceCode":"          }\n          try {\n            df.setDecimalFormatSymbols( dfs );\n            setValue( df.parse( getString() ).doubleValue() );\n          } catch ( Exception e ) {\n            String message = \"Couldn't convert string to number \" + e.toString();\n            if ( !Utils.isEmpty( pattern ) ) {\n              message += \" pattern=\" + pattern;\n            }\n            if ( !Utils.isEmpty( decimal ) ) {\n              message += \" decimal=\" + decimal;\n            }\n            if ( !Utils.isEmpty( grouping ) ) {\n              message += \" grouping=\" + grouping.charAt( 0 );\n            }\n            if ( !Utils.isEmpty( currency ) ) {\n              message += \" currency=\" + currency;\n            }\n            throw new KettleValueException( message );\n          }\n        }\n      } else {\n        throw new KettleValueException( \"Function STR2NUM works only on strings\" );\n      }\n    }\n    return this;\n  }\n\n  public Value dat2num() throws KettleValueException {\n    if ( isNull() ) {\n      setType( VALUE_TYPE_INTEGER );\n      return this;\n    }\n\n    if ( getType() == VALUE_TYPE_DATE ) {\n      if ( getString() == null ) {\n        setNull();","sourceCodeStart":3220,"sourceCodeEnd":3256,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/compatibility/Value.java#L3220-L3256","documentation":"Thrown when the legacy Value str2num() conversion fails: DecimalFormat.parse() threw while converting the string value to a double. The message is enriched with the conversion pattern, decimal, grouping and currency settings in effect, which identify the mismatch between the string and the formatter configuration.","triggerScenarios":"Thrown at core/src/main/java/org/pentaho/di/compatibility/Value.java:3238 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Align the conversion mask, decimal symbol, grouping symbol and currency symbol with the actual string data","Strip stray characters or whitespace from the input string before conversion","Check the reported pattern/decimal/grouping appended to the message to spot the misconfiguration"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}