apache/seatunnel · error · IllegalArgumentException
SNMP source host must not be blank
Error message
SNMP source host must not be blank
What it means
The SNMP source connector throws this IllegalArgumentException in its constructor when the configured 'host' option is missing, null, or whitespace-only. The host identifies the SNMP agent to poll; without it no SNMP session can be created, so configuration is rejected eagerly at job initialization rather than failing later at connection time.
Solutions
- Add a non-blank host value to the SNMP source config, e.g. host = "192.168.1.10" or a resolvable hostname
- Verify the option key is exactly 'host' (check SnmpSourceOptions.HOST)
- If using variable substitution, confirm the substituted value is non-empty at runtime
Example fix
// before host = "" // after host = "192.168.1.50"
Defensive patterns
Strategy: validation
Validate before calling
String host = config.get(SnmpSourceOptions.HOST);
if (host == null || host.trim().isEmpty()) {
throw new IllegalArgumentException("SNMP source 'host' is required and must not be blank");
} Type guard
boolean isValidHost(String host) {
return host != null && !host.trim().isEmpty();
} Try / catch
try {
SnmpSourceConfig cfg = new SnmpSourceConfig(config);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("host must not be blank")) {
// surface a config-fix hint to the user / fail fast
}
throw e;
} Prevention
- Always set host explicitly in the SNMP source block
- If templating configs, assert substituted variables are non-empty before rendering
- Keep the option key exactly 'host' and lint connector configs against SnmpSourceOptions
When it happens
Trigger: Constructing SnmpSourceConfig with a ReadonlyConfig whose SnmpSourceOptions.HOST value is absent from the HOCON config, present but empty ("") after parsing, or containing only spaces/tabs; e.g. `host = ""` or omitting host entirely in the source block.
Common situations: Copy-pasting a connector template and forgetting to fill in the agent address; using an env-variable placeholder like host = "${SNMP_HOST}" that resolves to empty; typo in the option key (e.g. 'hostname') so HOST falls back to its null/empty default.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Duplicate SNMP source OID
- SNMP sink community must not be blank
- SNMP sink host must not be blank
- SNMP sink oid_field, value_field, and value_type_field must…
- SNMP sink must not be blank
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/5fb8ac2bdc10f9d2.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/config/SnmpSourceConfig.java:51
public final class SnmpSourceConfig implements Serializable, SnmpTargetConfig {
private static final long serialVersionUID = 1L;
private static final Pattern NUMERIC_OID = Pattern.compile("^\\.?[0-9]+(\\.[0-9]+)+$");
private final String host;
private final int port;
private final String community;
private final List<OID> oids;
private final long timeoutMillis;
private final int retries;
private final long pollIntervalMillis;
/** Creates an SNMP source configuration from connector options. */
public SnmpSourceConfig(ReadonlyConfig config) {
String configuredHost = config.get(SnmpSourceOptions.HOST);
if (isBlank(configuredHost)) {
throw new IllegalArgumentException("SNMP source host must not be blank");
}
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");
}View on GitHub (pinned to cf67b549a7)