apache/seatunnel · error · IllegalArgumentException

SNMP source oids must not be empty

Error message

SNMP source oids must not be empty

What it means

parseOids() throws when the configured 'oids' list is null or empty. The source must know which OID subtrees to GET/WALK from the agent; an empty list means there is nothing to read, so configuration is rejected.

Solutions

  1. Provide at least one OID, e.g. oids = ["1.3.6.1.2.1.1.3.0"]
  2. Verify the upstream data feeding the oids list is non-empty before rendering the config

Example fix

// before
oids = []
// after
oids = ["1.3.6.1.2.1.1.3.0", "1.3.6.1.2.1.2.2.1.10.1"]
Defensive patterns

Strategy: validation

Validate before calling

List<String> oids = config.get(SnmpSourceOptions.OIDS);
if (oids == null || oids.isEmpty()) {
    throw new IllegalArgumentException("SNMP 'oids' must contain at least one OID");
}

Type guard

boolean hasOids(List<String> oids) {
    return oids != null && !oids.isEmpty();
}

Try / catch

try {
    SnmpSourceConfig cfg = new SnmpSourceConfig(config);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("oids must not be empty")) {
        // abort job or inject a default OID set before re-submitting
    }
    throw e;
}

Prevention

When it happens

Trigger: SnmpSourceConfig constructor calls parseOids(config.get(SnmpSourceOptions.OIDS)); fires when the oids option is omitted entirely or set to an empty list (oids = []).

Common situations: Generating config programmatically where the OID list came from an upstream source that was empty; leaving the template's oids placeholder unedited; accidentally clearing the list while debugging.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/ab5764a6d3d611a1. 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:103

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

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

    @Override
    public String getCommunity() {
        return community;
    }

    private static List<OID> parseOids(List<String> configuredOids) {
        if (configuredOids == null || configuredOids.isEmpty()) {
            throw new IllegalArgumentException("SNMP source oids must not be empty");
        }

        List<OID> parsed = new ArrayList<>(configuredOids.size());
        Set<String> unique = new LinkedHashSet<>();
        for (String configuredOid : configuredOids) {
            String value = configuredOid == null ? null : configuredOid.trim();
            if (value == null || !NUMERIC_OID.matcher(value).matches()) {
                throw new IllegalArgumentException(
                        "SNMP source oids must contain only numeric OIDs: " + configuredOid);
            }
            if (value.charAt(0) == '.') {
                value = value.substring(1);
            }
            OID oid;
            try {
                oid = new OID(value);
            } catch (RuntimeException e) {
                throw new IllegalArgumentException("Invalid SNMP source OID: " + value, e);

View on GitHub (pinned to cf67b549a7)