apache/seatunnel · error · IllegalArgumentException
Duplicate SNMP source OID: {oid}
Error message
Duplicate SNMP source OID: {oid} What it means
parseOids() normalizes each parsed OID via oid.toString() and tracks them in a LinkedHashSet; if a normalized OID was already seen it throws this IllegalArgumentException. Duplicate OIDs would make the source poll the same variable twice, wasting requests and duplicating data, so they are rejected outright.
Source
Thrown at seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/config/SnmpSourceConfig.java:125
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);
}
public List<OID> getOids() {
return oids;
}
@Override
public long getTimeoutMillis() {
return timeoutMillis;
}
@Override
public int getRetries() {
return retries;View on GitHub (pinned to cf67b549a7)
Solutions
- Remove duplicate entries from the oids list, keeping one normalized form (no leading dot)
- Deduplicate programmatically before writing the config: new LinkedHashSet<>(oids) after normalizing leading dots
Example fix
// before oids = ["1.3.6.1.2.1.1.3.0", ".1.3.6.1.2.1.1.3.0"] // after oids = ["1.3.6.1.2.1.1.3.0"]
Defensive patterns
Strategy: validation
Validate before calling
Set<String> seen = new LinkedHashSet<>();
for (String oid : oids) {
String normalized = oid.trim().replaceFirst("^\\.", "");
if (!seen.add(normalized)) {
throw new IllegalArgumentException("Duplicate OID after normalization: " + normalized);
}
} Type guard
boolean hasNoDuplicateOids(List<String> oids) {
Set<String> seen = new HashSet<>();
for (String oid : oids) {
if (!seen.add(oid.trim().replaceFirst("^\\.", ""))) return false;
}
return true;
} Try / catch
try {
SnmpSourceConfig cfg = new SnmpSourceConfig(config);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Duplicate SNMP source OID")) {
// deduplicate the list (normalize leading dots) and rebuild the config
}
throw e;
} Prevention
- Deduplicate oids through a LinkedHashSet after normalizing leading dots when merging lists
- Pick one canonical OID format (no leading dot) across all configs
- Review merged config files for repeated OID entries before deployment
When it happens
Trigger: SnmpSourceConfig -> parseOids(): two entries in the oids list normalize to the same OID string — e.g. ["1.3.6.1.2.1.1.3.0", ".1.3.6.1.2.1.1.3.0"] (leading dot stripped) or the same OID listed twice.
Common situations: Merging OID lists from multiple sources (template + defaults) without deduplication; leading-dot and no-leading-dot variants of the same OID; copy-paste duplication when extending the list.
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
- SNMP sink host must not be blank
- SNMP sink port must be between 1 and 65535
- SNMP sink community must not be blank
- SNMP sink timeout_millis must be greater than 0
- SNMP sink retries must not be negative
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/a0957d150d4ac8ec.
Report an issue: GitHub.