apache/seatunnel · error · IllegalArgumentException
SNMP source timeout_millis must be greater than 0
Error message
SNMP source timeout_millis must be greater than 0
What it means
validate() requires the per-request SNMP timeout to be strictly positive. The timeout_millis option bounds how long each SNMP request waits for a response; zero or negative values would cause immediate failures or undefined behavior in SNMP4j.
Source
Thrown at seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/config/SnmpSourceConfig.java:71
this.host = configuredHost.trim();
this.port = config.get(SnmpSourceOptions.PORT);
this.community = config.get(SnmpSourceOptions.COMMUNITY);
this.oids = parseOids(config.get(SnmpSourceOptions.OIDS));
this.timeoutMillis = config.get(SnmpSourceOptions.TIMEOUT_MILLIS);
this.retries = config.get(SnmpSourceOptions.RETRIES);
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;
}View on GitHub (pinned to cf67b549a7)
Solutions
- Set timeout_millis to a positive value, e.g. timeout_millis = 1500 (default range is typically 1000-5000ms)
- Remove the option to use the connector's default timeout if one is defined in SnmpSourceOptions
Example fix
// before timeout_millis = 0 // after timeout_millis = 1500
Defensive patterns
Strategy: validation
Validate before calling
Integer timeout = config.get(SnmpSourceOptions.TIMEOUT_MILLIS);
if (timeout == null || timeout <= 0) {
throw new IllegalArgumentException("timeout_millis must be > 0");
} Type guard
boolean isValidTimeout(Integer timeoutMillis) {
return timeoutMillis != null && timeoutMillis > 0;
} Try / catch
try {
SnmpSourceConfig cfg = new SnmpSourceConfig(config);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("timeout_millis must be greater than 0")) {
// fall back to a sane default like 1500ms
}
throw e;
} Prevention
- Use millisecond units consistently; 1000-5000ms is a typical range
- Omit the option to use the connector default rather than setting 0
- Never use 0 or -1 as 'no timeout' sentinels here
When it happens
Trigger: SnmpSourceConfig constructor reads SnmpSourceOptions.TIMEOUT_MILLIS then validate() throws when timeoutMillis <= 0 — e.g. timeout_millis = 0 or a negative number in the config.
Common situations: Setting timeout_millis = 0 intending 'no timeout'; unit confusion (writing seconds value expecting it passes a sanity check, e.g. -1 as 'infinite'); fat-fingering a negative number.
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.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Option 'operation_timeout_ms' must be greater than zero
- Option 'visibility_timeout_seconds' must be between 1 and 60
- INVALID_CONFIG
- SNMP sink host must not be blank
- SNMP sink port must be between 1 and 65535
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/4951f4487634ebf7.
Report an issue: GitHub.