apache/seatunnel · error · IllegalArgumentException

SNMP source poll_interval_millis must be greater than 0

Error message

SNMP source poll_interval_millis must be greater than 0

What it means

validate() requires poll_interval_millis to be strictly positive. This option sets how often the source polls the SNMP agent; a zero or negative interval is nonsensical and would break the polling scheduler.

Source

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

        this.pollIntervalMillis = config.get(SnmpSourceOptions.POLL_INTERVAL_MILLIS);
        validate();
    }

    private void validate() {
        if (port < 1 || port > 65535) {
            throw new IllegalArgumentException("SNMP source port must be between 1 and 65535");
        }
        if (isBlank(community)) {
            throw new IllegalArgumentException("SNMP source community must not be blank");
        }
        if (timeoutMillis <= 0) {
            throw new IllegalArgumentException("SNMP source timeout_millis must be greater than 0");
        }
        if (retries < 0) {
            throw new IllegalArgumentException("SNMP source retries must not be negative");
        }
        if (pollIntervalMillis <= 0) {
            throw new IllegalArgumentException(
                    "SNMP source poll_interval_millis must be greater than 0");
        }
    }

    private static boolean isBlank(String value) {
        return value == null || value.trim().isEmpty();
    }

    @Override
    public String getHost() {
        return host;
    }

    @Override
    public int getPort() {
        return port;
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set poll_interval_millis to a positive interval, e.g. poll_interval_millis = 60000 for one-minute polling
  2. Remove the option to use the connector's default polling interval

Example fix

// before
poll_interval_millis = 0
// after
poll_interval_millis = 60000
Defensive patterns

Strategy: validation

Validate before calling

Long interval = config.get(SnmpSourceOptions.POLL_INTERVAL_MILLIS);
if (interval == null || interval <= 0) {
    throw new IllegalArgumentException("poll_interval_millis must be > 0");
}

Type guard

boolean isValidInterval(Long pollIntervalMillis) {
    return pollIntervalMillis != null && pollIntervalMillis > 0;
}

Try / catch

try {
    SnmpSourceConfig cfg = new SnmpSourceConfig(config);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("poll_interval_millis must be greater than 0")) {
        // substitute a default interval, e.g. 60000ms
    }
    throw e;
}

Prevention

When it happens

Trigger: SnmpSourceConfig.validate() throws when the configured SnmpSourceOptions.POLL_INTERVAL_MILLIS value is <= 0, e.g. poll_interval_millis = 0 or a negative value.

Common situations: Setting 0 intending 'poll as fast as possible'; unit confusion (poll_interval_seconds written into a millis option as a decimal truncated to 0); template values left blank and resolved to 0.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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