{"record":{"id":"15100ac308baf13d","repo":"pentaho/pentaho-kettle","slug":"tostring-couldn-t-convert-bignumber-to-string","errorCode":null,"errorMessage":"<toString()> : couldn't convert BigNumber to String ","messagePattern":"<toString\\(\\)> : couldn't convert BigNumber to String ","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java","lineNumber":1372,"sourceCode":"            + \"property KETTLE_IGNORE_OUT_OF_RANGE_EXCEPTION to \\\"Y\\\". \" );\n        }\n      }\n\n      return new Long( number.longValue() );\n    } catch ( Exception e ) {\n      throw new KettleValueException( toString() + \" : couldn't convert String to Integer\", e );\n    }\n  }\n\n  protected synchronized String convertBigNumberToString( BigDecimal number ) throws KettleValueException {\n    if ( number == null ) {\n      return null;\n    }\n\n    try {\n      return getDecimalFormat( bigNumberFormatting ).format( number );\n    } catch ( Exception e ) {\n      throw new KettleValueException( toString() + \" : couldn't convert BigNumber to String \", e );\n    }\n  }\n\n  protected synchronized BigDecimal convertStringToBigNumber( String string ) throws KettleValueException {\n    string = Const.trimToType( string, getTrimType() ); // see if trimming needs\n    // to be performed before\n    // conversion\n\n    if ( Utils.isEmpty( string ) ) {\n      return null;\n    }\n\n    try {\n      DecimalFormat format = getDecimalFormat( bigNumberFormatting );\n      Number number;\n      if ( lenientStringToNumber ) {\n        number = format.parse( string );\n      } else {","sourceCodeStart":1354,"sourceCodeEnd":1390,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java#L1354-L1390","documentation":"Thrown by ValueMetaBase.convertBigNumberToString when formatting a BigDecimal with the configured DecimalFormat throws. Kettle wraps any formatting exception (bad conversion mask, illegal symbols) into a KettleValueException identifying the value via toString().","triggerScenarios":"convertBigNumberToString(BigDecimal) called (e.g. writing text output, converting storage) with a conversion mask/DecimalFormat that cannot format the BigDecimal — invalid mask characters, incompatible rounding settings, or a broken DecimalFormat configuration on the ValueMeta.","commonSituations":"A typo in setConversionMask (e.g. '###.##0,00' stray characters), reusing a non-thread-safe DecimalFormat incorrectly, or mask set for integers while value is a huge BigDecimal.","solutions":["Check getCause() for the DecimalFormat error and correct setConversionMask on the field's ValueMeta.","Use a standard mask such as '#.###############' or '0.00' that DecimalFormat accepts.","If no special formatting is needed, clear the conversion mask (null) so Kettle uses its default BigDecimal formatting.","Verify the BigDecimal itself is finite and not NaN-like input produced upstream."],"exampleFix":"// before\nvm.setConversionMask(\"##,##0.00### (bad)\"); // invalid pattern -> format throws\n// after\nvm.setConversionMask(\"#,##0.00\");","handlingStrategy":"validation","validationCode":"try {\n    new java.text.DecimalFormat(mask);\n} catch (IllegalArgumentException e) {\n    throw new IllegalArgumentException(\"Invalid conversion mask: \" + mask);\n}","typeGuard":"static boolean isValidDecimalFormat(String mask) { try { new java.text.DecimalFormat(mask); return true; } catch (IllegalArgumentException e) { return false; } }","tryCatchPattern":"try {\n    String out = valueMeta.convertBigNumberToString(bd);\n} catch (KettleValueException e) {\n    String out = bd.toPlainString(); // fallback formatting\n}","preventionTips":["Test DecimalFormat masks in isolation before putting them in transformation metadata","Prefer simple masks ('0.00', '#.###') over hand-built locale strings","Leave the conversion mask unset when default formatting suffices"],"tags":["pdi","formatting","bigdecimal","kettle"],"backgroundTag":"invalid-argument-format","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"}