apache/seatunnel · error · CassandraConnectorException

PARSE_IP_ADDRESS_FAILED

PARSE_IP_ADDRESS_FAILED

Error message

PARSE_IP_ADDRESS_FAILED

What it means

reconvertAndInject writes SeaTunnel field values back into a Cassandra bound statement. For INET columns it parses the string with InetAddress.getByName; when the host/IP string is unresolvable or malformed it throws PARSE_IP_ADDRESS_FAILED wrapping the UnknownHostException.

Solutions

  1. Supply a valid literal IPv4/IPv6 address string (e.g. "192.168.0.1") for INET columns
  2. Verify the value has no surrounding whitespace or placeholders
  3. Fix DNS resolution if a hostname is intentionally used, or use the IP instead
  4. Validate/normalize the column upstream before writing

Example fix

// before
{"ip": "192.168.0.999"}
// after
{"ip": "192.168.0.1"}
Defensive patterns

Strategy: validation

Validate before calling

String v = (String) fileValue;
boolean valid = v != null && !v.trim().isEmpty()
    && (v.matches("^(\\d{1,3}\\.){3}\\d{1,3}$") || v.matches("^[0-9a-fA-F:]+$"));
if (!valid) throw new IllegalArgumentException("invalid INET value: " + v);

Type guard

boolean isParseableInet(String s) {
    try { InetAddress.getByName(s); return true; } catch (UnknownHostException e) { return false; }
}

Try / catch

try {
    stmt = stmt.setInetAddress(i, InetAddress.getByName(ip));
} catch (UnknownHostException e) {
    throw new IllegalArgumentException("Cannot parse INET value: " + ip, e);
}

Prevention

When it happens

Trigger: Writing a row whose INET column value is not a valid literal IP address and is not resolvable as a hostname (UnknownHostException from InetAddress.getByName).

Common situations: Passing empty strings, invalid formats ('999.1.1.1'), or hostnames when DNS is unavailable in the job environment; seed data with malformed IP strings.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/839ea8e783ed7010. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-cassandra/src/main/java/org/apache/seatunnel/connectors/seatunnel/cassandra/util/TypeConvertUtil.java:313

        switch (type.getProtocolCode()) {
            case ProtocolConstants.DataType.VARCHAR:
            case ProtocolConstants.DataType.ASCII:
                statement = statement.setString(index, (String) fileValue);
                return statement;
            case ProtocolConstants.DataType.VARINT:
                statement = statement.setBigInteger(index, new BigInteger((String) fileValue));
                return statement;
            case ProtocolConstants.DataType.UUID:
            case ProtocolConstants.DataType.TIMEUUID:
                statement = statement.setUuid(index, UUID.fromString((String) fileValue));
                return statement;
            case ProtocolConstants.DataType.INET:
                try {
                    statement =
                            statement.setInetAddress(
                                    index, InetAddress.getByName((String) fileValue));
                } catch (UnknownHostException e) {
                    throw new CassandraConnectorException(
                            CassandraConnectorErrorCode.PARSE_IP_ADDRESS_FAILED, e);
                }
                return statement;
            case ProtocolConstants.DataType.TINYINT:
                statement = statement.setByte(index, (Byte) fileValue);
                return statement;
            case ProtocolConstants.DataType.SMALLINT:
                statement = statement.setShort(index, (Short) fileValue);
                return statement;
            case ProtocolConstants.DataType.INT:
                statement = statement.setInt(index, (Integer) fileValue);
                return statement;
            case ProtocolConstants.DataType.BIGINT:
            case ProtocolConstants.DataType.COUNTER:
                statement = statement.setLong(index, (Long) fileValue);
                return statement;
            case ProtocolConstants.DataType.FLOAT:
                statement = statement.setFloat(index, (Float) fileValue);

View on GitHub (pinned to cf67b549a7)