apache/seatunnel · critical · SnmpConnectorException

CONNECTION_FAILED

CONNECTION_FAILED

Error message

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

What it means

SnmpSourceReader.open() initializes the SNMP client for polling. If client setup throws IOException, the reader rethrows it as SnmpConnectorException with CONNECTION_FAILED after logging that open failed. The source task cannot start reading from this agent.

Source

Thrown at seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/source/SnmpSourceReader.java:77

            SnmpClientFactory clientFactory,
            LongSupplier currentTimeMillis) {
        this.config = config;
        this.context = context;
        this.clientFactory = clientFactory;
        this.currentTimeMillis = currentTimeMillis;
    }

    @Override
    public void open() {
        try {
            client = clientFactory.create(config);
            LOG.info(
                    "SNMP source reader opened for agent [{}:{}] with [{}] OIDs",
                    config.getHost(),
                    config.getPort(),
                    config.getOids().size());
        } catch (IOException e) {
            throw new SnmpConnectorException(
                    SnmpConnectorErrorCode.CONNECTION_FAILED,
                    "Failed to initialize SNMP client for agent "
                            + config.getHost()
                            + ":"
                            + config.getPort(),
                    e);
        }
    }

    @Override
    public void pollNext(Collector<SeaTunnelRow> output) throws Exception {
        if (closed || noMoreSplits) {
            return;
        }

        if (Boundedness.UNBOUNDED.equals(context.getBoundedness())) {
            long waitMillis = nextPollTimeMillis - currentTimeMillis.getAsLong();
            if (waitMillis > 0) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Validate the source config: host resolves from the worker, port correct (161), SNMP version supported.
  2. Check community string and SNMPv3 USM credentials before submitting the job.
  3. Read the wrapped IOException cause for the exact transport error.
  4. Test connectivity from the SeaTunnel worker node (not just the client machine).
  5. Review SnmpSourceConfig validation and fix any out-of-range timeout/retry values.

Example fix

// before
{ "host": "localhost", "port": 1610 }
// after
{ "host": "localhost", "port": 161 }
Defensive patterns

Strategy: validation

Validate before calling

// fail fast before submitting the job
Objects.requireNonNull(config.getHost(), "host required");
if (config.getPort() < 1 || config.getPort() > 65535) throw new IllegalArgumentException("invalid port");
InetAddress.getByName(config.getHost());

Try / catch

try {
    reader.open();
} catch (SnmpConnectorException e) {
    if (e.getCode() == SnmpConnectorErrorCode.CONNECTION_FAILED)
        LOG.error("SNMP source init failed for {}:{}", config.getHost(), config.getPort(), e.getCause());
    throw e;
}

Prevention

When it happens

Trigger: Calling open() on SnmpSourceReader when Snmp4jClient construction/initialization (SNMP4J session/transport setup for host:port) throws IOException.

Common situations: Unresolvable hostname or wrong port in source config; invalid SNMP version/community in config; SNMPv3 USM/engine-discovery failure; worker host lacking network access or UDP sockets.

Related errors


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