pentaho/pentaho-kettle · error · KettleValueException
: couldn't convert string [" + string + "] to an internet…
Error message
: couldn't convert string [" + string + "] to an internet address
What it means
convertStringToInternetAddress() parses a string via InetAddress.getByName(); any parse/resolution failure is wrapped in KettleValueException 'couldn't convert string [...] to an internet address'. Note the source string is included in the message.
Solutions
- Clean/trim the input and confirm it is a valid IP literal (or resolvable host) before conversion
- Set the field type to String instead of Internet Address for non-IP values
- Pre-validate with a regex/IP parse in a modified Java Script step or filter invalid rows
- Catch KettleValueException and use Kettle error handling to send bad rows aside
Example fix
// before
row[ipIdx] = inetMeta.convertData(strMeta, row[hostIdx]);
// after
String s = strMeta.getString(row[hostIdx]).trim();
if (!s.matches("[0-9a-fA-F:.]+")) row[ipIdx] = null;
else row[ipIdx] = inetMeta.convertData(strMeta, s); Defensive patterns
Strategy: validation
Validate before calling
String s = stringMeta.getString(v);
if (s == null || !s.trim().matches("([0-9]{1,3}\\.){3}[0-9]{1,3}|[0-9a-fA-F:]+")) { /* invalid, skip or null */ } Type guard
boolean looksLikeIp(String s){ return s != null && s.trim().matches("([0-9]{1,3}\\.){3}[0-9]{1,3}|[0-9a-fA-F:]+") && !s.trim().isEmpty(); } Try / catch
try { addr = inetMeta.convertData(strMeta, s); } catch (KettleValueException e) { /* bad literal: log s and default */ } Prevention
- Trim inputs before conversion
- Reject hostnames unless DNS is guaranteed available
- Pre-filter malformed address literals
- Use Kettle error handling for unparseable rows
When it happens
Trigger: getString()/getInternetAddress()/getValueFromResultSet/convertData encountering a string that is not a valid IP literal (getByName with an unresolvable hostname also throws). Whitespace or locale-specific formatting in the input also triggers this.
Common situations: CSV/log fields containing hostnames, empty strings, or malformed addresses ('999.1.1.1', '::gg::'); DNS-less environments where getByName cannot resolve host names; trailing spaces in fixed-width file columns.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Unable to clone Internet Address
- Unable to convert an Integer to an internet address
- Unable to convert Internet Address v6 to an Integer: " +…
- : Unable to get Internet Address from resultset at index "…
- : Unable to set Internet address value on prepared…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/5d668df360905161.
Report an issue: GitHub.
Appendix: source
Thrown at core/src/main/java/org/pentaho/di/core/row/value/ValueMetaInternetAddress.java:285
return InetAddress.getByAddress( addr );
} catch ( Exception e ) {
throw new KettleValueException( "Unable to convert an Integer to an internet address", e );
}
}
protected synchronized InetAddress convertStringToInternetAddress( String string ) throws KettleValueException {
// See if trimming needs to be performed before conversion
//
string = Const.trimToType( string, getTrimType() );
if ( Utils.isEmpty( string ) ) {
return null;
}
try {
return InetAddress.getByName( string );
} catch ( Exception e ) {
throw new KettleValueException( toString()
+ " : couldn't convert string [" + string + "] to an internet address", e );
}
}
protected synchronized String convertInternetAddressToString( InetAddress inetAddress ) throws KettleValueException {
if ( inetAddress == null ) {
return null;
}
return inetAddress.getHostAddress();
}
@Override
public Object convertDataFromString( String pol, ValueMetaInterface convertMeta, String nullIf, String ifNull,
int trim_type ) throws KettleValueException {
// null handling and conversion of value to null
//View on GitHub (pinned to f3058517a1)