{"record":{"id":"37b3661f1c35352b","repo":"pentaho/pentaho-kettle","slug":"unable-to-convert-internet-address-v6-to-an-integer","errorCode":null,"errorMessage":"Unable to convert Internet Address v6 to an Integer: \" + getString( object ) + \" (The precision is too high to be contained in a long integer value)","messagePattern":"Unable to convert Internet Address v6 to an Integer: \" \\+ getString\\( object \\) \\+ \" \\(The precision is too high to be contained in a long integer value\\)","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/core/row/value/ValueMetaInternetAddress.java","lineNumber":163,"sourceCode":"  }\n\n  @Override\n  public Date getDate( Object object ) throws KettleValueException {\n    throw new KettleValueException( toStringMeta()\n      + \": it's not possible to convert from Internet Address to a date\" );\n  }\n\n  @Override\n  public Long getInteger( Object object ) throws KettleValueException {\n    InetAddress address = getInternetAddress( object );\n    if ( address == null ) {\n      return null;\n    }\n    long total = 0L;\n    byte[] addr = address.getAddress();\n\n    if ( addr.length > 8 ) {\n      throw new KettleValueException( \"Unable to convert Internet Address v6 to an Integer: \"\n        + getString( object ) + \" (The precision is too high to be contained in a long integer value)\" );\n    }\n\n    for ( int i = 0; i < addr.length; i++ ) {\n      total += ( addr[i] & 0xFF ) * ( (long) Math.pow( 256, ( addr.length - 1 - i ) ) );\n    }\n\n    return total;\n  }\n\n  @Override\n  public Double getNumber( Object object ) throws KettleValueException {\n    Long l = getInteger( object );\n    if ( l == null ) {\n      return null;\n    }\n\n    return l.doubleValue();","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/core/row/value/ValueMetaInternetAddress.java#L145-L181","documentation":"ValueMetaInternetAddress.getInteger() converts an InetAddress value to a numeric (long) representation. An IPv6 address is 16 bytes, so its full numeric value cannot fit into a 64-bit signed long. The library throws KettleValueException when the stored address has more than 8 bytes (i.e., any IPv6 address).","triggerScenarios":"Calling getInteger() (directly or via Integer/Number conversion of the value meta) on a ValueData holding an InetAddress whose byte length exceeds 8 — i.e., any IPv6 address such as '2001:db8::1'.","commonSituations":"Rows flowing from database columns or input files containing IPv6 addresses into steps that request the value as an Integer (e.g., a 'Value Mapper', calculator, or User Defined Java Expression reading the field as a number). Environments migrating to dual-stack IPv4/IPv6 networks where data sources now emit IPv6.","solutions":["Only call getInteger() on fields guaranteed to be IPv4 (or otherwise <= 8 bytes); validate the address family first","Use getString() (textual address) instead of a numeric representation when IPv6 may be present","Catch KettleValueException around getInteger() and fall back to the string form","Store the address as a BigNumber (BigDecimal) via getBigNumber() if a numeric form is truly required for IPv6"],"exampleFix":"// before\nLong n = inetValueMeta.getInteger(rowData[i]);\n// after\nInetAddress addr = inetValueMeta.getInetAddress(rowData[i]);\nLong n = (addr != null && addr.getAddress().length <= 8)\n    ? inetValueMeta.getInteger(rowData[i])\n    : null; // IPv6 has no long representation","handlingStrategy":"type-guard","validationCode":"boolean isIPv4(InetAddress a){ return a != null && a.getAddress().length <= 8; }","typeGuard":"if (inetMeta.getInetAddress(value) instanceof InetAddress a && a.getAddress().length <= 8) { /* safe to getInteger */ }","tryCatchPattern":"try { n = inetMeta.getInteger(v); } catch (KettleValueException e) { /* IPv6 or invalid */ n = null; }","preventionTips":["Guard with addr.getAddress().length <= 8 before numeric conversion","Prefer getString() for IPv6 data","Filter IPv6 rows before numeric steps"],"tags":["ipv6","type-conversion","numeric-overflow","kettle"],"backgroundTag":"value-out-of-range","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"}