apache/seatunnel · error · IllegalArgumentException

SNMP source oids must contain only numeric OIDs: ${configure

Error message

SNMP source oids must contain only numeric OIDs: ${configuredOid}

What it means

parseOids() validates each configured OID against a NUMERIC_OID regex and throws when any entry is null or not a purely numeric dotted OID string. Only numeric form (e.g. '1.3.6.1.2.1.1.3.0') is accepted; symbolic names like 'sysUpTime.0' require an SNMP MIB resolver this connector does not perform.

Source

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

        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);
            }
            String normalized = oid.toString();
            if (!unique.add(normalized)) {
                throw new IllegalArgumentException("Duplicate SNMP source OID: " + normalized);
            }
            parsed.add(oid);
        }
        return Collections.unmodifiableList(parsed);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Replace symbolic names with their numeric dotted equivalents (resolve via an MIB browser or `snmptranslate -On sysUpTime.0` -> 1.3.6.1.2.1.1.3.0)
  2. Remove leading '.' and fix malformed dotted strings (no empty segments)
  3. Filter null/blank entries out of the list before passing the config

Example fix

// before
oids = ["sysUpTime.0"]
// after
oids = ["1.3.6.1.2.1.1.3.0"]
Defensive patterns

Strategy: validation

Validate before calling

Pattern NUMERIC_OID = Pattern.compile("\\d+(\.\d+)*");
for (String oid : oids) {
    String v = oid == null ? null : oid.trim();
    if (v == null || !NUMERIC_OID.matcher(v).matches()) {
        throw new IllegalArgumentException("OID must be numeric dotted form: " + oid);
    }
}

Type guard

boolean isNumericOid(String oid) {
    if (oid == null) return false;
    String v = oid.trim();
    if (v.startsWith(".")) v = v.substring(1);
    return v.matches("\\d+(\\.\\d+)*");
}

Try / catch

try {
    SnmpSourceConfig cfg = new SnmpSourceConfig(config);
} catch (IllegalArgumentException e) {
    if (e.getMessage().contains("only numeric OIDs")) {
        // resolve MIB names to numeric form, e.g. via snmptranslate -On
    }
    throw e;
}

Prevention

When it happens

Trigger: SnmpSourceConfig constructor -> parseOids(); fires when any element of the oids list is null or fails the numeric OID pattern — e.g. oids = ["sysUpTime.0"], ["1.3.6.1..2"], or a list containing a null element.

Common situations: Using human-readable MIB names copied from vendor documentation or an MIB browser in 'name' mode; trailing/leading dots or double dots; nulls injected by programmatic config generation.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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