apache/seatunnel · critical · SnmpConnectorException

CONNECTION_FAILED

CONNECTION_FAILED

Error message

Failed to initialize SNMP SET client for agent {host}:{port}

What it means

SnmpSinkWriter's constructor creates the SNMP SET client via SnmpSetClientFactory.create(config). If client creation (Snmp.open/transport setup) throws an IOException, the writer rethrows it as SnmpConnectorException with CONNECTION_FAILED. This fails writer construction, meaning the sink task cannot start against this agent.

Source

Thrown at seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/sink/SnmpSinkWriter.java:47

/** Writes each row as one synchronous SNMPv2c SET request. */
public final class SnmpSinkWriter extends AbstractSinkWriter<SeaTunnelRow, Void> {

    private final SnmpSinkConfig config;
    private final SnmpSinkRowConverter converter;
    private final SnmpSetClient client;

    public SnmpSinkWriter(SnmpSinkConfig config, SeaTunnelRowType rowType) {
        this(config, rowType, Snmp4jSetClient::new);
    }

    SnmpSinkWriter(
            SnmpSinkConfig config, SeaTunnelRowType rowType, SnmpSetClientFactory clientFactory) {
        this.config = config;
        this.converter = new SnmpSinkRowConverter(config, rowType);
        try {
            this.client = clientFactory.create(config);
        } catch (IOException e) {
            throw new SnmpConnectorException(
                    SnmpConnectorErrorCode.CONNECTION_FAILED,
                    "Failed to initialize SNMP SET client for agent "
                            + config.getHost()
                            + ":"
                            + config.getPort(),
                    e);
        }
    }

    @Override
    public void write(SeaTunnelRow row) {
        SnmpSetRequest request = converter.convert(row);
        try {
            client.set(request);
        } catch (IOException e) {
            throw new SnmpConnectorException(
                    SnmpConnectorErrorCode.WRITE_FAILED,
                    "Failed to set OID "

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the sink config: host must resolve (DNS/hosts entry) and port must match the agent (usually 161).
  2. Validate SnmpSinkConfig fields (version, community, timeouts) are within SNMP4J-supported values.
  3. For SNMPv3, verify USM user/auth/priv settings; engine discovery failures surface at init time.
  4. Inspect the wrapped cause IOException for the underlying transport error.
  5. Pre-test connectivity from the SeaTunnel worker node, since init happens on the task machine.

Example fix

// before
host = "snmp-prod.internal"  // unresolvable from worker
// after
host = "10.0.0.5" // or add DNS entry reachable from the SeaTunnel worker
Defensive patterns

Strategy: validation

Validate before calling

// validate before creating the writer
InetAddress.getByName(config.getHost()); // throws UnknownHostException early
if (config.getPort() <= 0 || config.getPort() > 65535) throw new IllegalArgumentException("bad port");
// optional live probe
snmpGetProbe(config.getHost(), config.getPort(), config.getCommunity(), 5000);

Try / catch

try {
    SnmpSinkWriter writer = new SnmpSinkWriter(config, rowType, clientFactory);
} catch (SnmpConnectorException e) {
    if (e.getCode() == SnmpConnectorErrorCode.CONNECTION_FAILED)
        LOG.error("SNMP sink init failed for {}:{}", config.getHost(), config.getPort(), e.getCause());
    throw e;
}

Prevention

When it happens

Trigger: Constructing SnmpSinkWriter(config, rowType, clientFactory) when clientFactory.create(config) throws IOException — typically SNMP4J transport/listener initialization failure for host:port.

Common situations: Invalid or unresolvable host configured in the sink; invalid SNMP version or community settings in SnmpSinkConfig; SNMPv3 engine discovery failure on construction; local resource issues binding a UDP socket.

Related errors


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