pentaho/pentaho-kettle · error · KettleException

Invalid IP address

Error message

Invalid IP address

What it means

In JobEntrySNMPTrap.execute, when targettype is SNMPv1/v2c, the UDP target address built from the configured serverName is validated with SnmpTarget.getAddress().isValid(); if invalid, KettleException 'Invalid IP address' is thrown. The configured host could not be resolved to a usable SNMP transport address.

Solutions

  1. Enter a bare, resolvable hostname or valid IP (no scheme/port) in the Server name field and test with ping/nslookup.
  2. Use an explicit IP address to bypass DNS in environments without name resolution.
  3. Check /etc/hosts or container DNS configuration on the machine running the job.
  4. Log/print the targetserver value in a prior step to confirm what the entry actually receives (e.g. from a variable).

Example fix

// before: variable contains 'http://192.168.1.10' -> invalid
setTargetServer("http://192.168.1.10");
// after: bare host or IP
setTargetServer("192.168.1.10");
Defensive patterns

Strategy: validation

Validate before calling

String host = getTargetServer();
if (host == null || host.trim().isEmpty() || host.contains("://")) {
  throw new IllegalArgumentException("Server name must be a bare hostname or IP: " + host);
}
InetAddress.getByName(host.trim()); // throws UnknownHostException if unresolvable

Try / catch

try {
  result = jobEntry.execute(prevResult, nr);
} catch (KettleException e) {
  if (e.getMessage().contains("Invalid IP address")) {
    logError("Check SNMP server name/port config: " + getTargetServer());
  }
}

Prevention

When it happens

Trigger: execute() with community-based trap target where the serverName field is an unresolvable hostname, an invalid IP string (e.g. '256.1.1.1', empty, or containing protocol prefix/whitespace), or a name requiring DNS that fails.

Common situations: Typo in host name; DNS not resolving in the job's environment (container without DNS); host entered as 'http://host' or 'host:port' instead of bare host; IPv6 string given where only IPv4 is supported by the target construction.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/b92452fb1777ca1d. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/snmptrap/JobEntrySNMPTrap.java:422

      UdpAddress udpAddress = new UdpAddress( InetAddress.getByName( servername ), nrPort );
      ResponseEvent response = null;
      if ( targettype.equals( target_type_Code[0] ) ) {
        // Community target
        String community = environmentSubstitute( comString );

        CommunityTarget target = new CommunityTarget();
        PDUv1 pdu1 = new PDUv1();
        transMap.listen();

        target.setCommunity( new OctetString( community ) );
        target.setVersion( SnmpConstants.version1 );
        target.setAddress( udpAddress );
        if ( target.getAddress().isValid() ) {
          if ( log.isDebug() ) {
            logDebug( "Valid IP address" );
          }
        } else {
          throw new KettleException( "Invalid IP address" );
        }
        target.setRetries( retry );
        target.setTimeout( timeOut );

        // create the PDU
        pdu1.setGenericTrap( 6 );
        pdu1.setSpecificTrap( PDUv1.ENTERPRISE_SPECIFIC );
        pdu1.setEnterprise( new OID( Oid ) );
        pdu1.add( new VariableBinding( new OID( Oid ), new OctetString( messageString ) ) );

        response = snmp.send( pdu1, target );

      } else {
        // User target
        String userName = environmentSubstitute( user );
        String passPhrase = environmentSubstitute( passphrase );
        String engineID = environmentSubstitute( engineid );

View on GitHub (pinned to f3058517a1)