{"record":{"id":"a0957d150d4ac8ec","repo":"apache/seatunnel","slug":"duplicate-snmp-source-oid-oid","errorCode":null,"errorMessage":"Duplicate SNMP source OID: {oid}","messagePattern":"Duplicate SNMP source OID: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/config/SnmpSourceConfig.java","lineNumber":125,"sourceCode":"        Set<String> unique = new LinkedHashSet<>();\n        for (String configuredOid : configuredOids) {\n            String value = configuredOid == null ? null : configuredOid.trim();\n            if (value == null || !NUMERIC_OID.matcher(value).matches()) {\n                throw new IllegalArgumentException(\n                        \"SNMP source oids must contain only numeric OIDs: \" + configuredOid);\n            }\n            if (value.charAt(0) == '.') {\n                value = value.substring(1);\n            }\n            OID oid;\n            try {\n                oid = new OID(value);\n            } catch (RuntimeException e) {\n                throw new IllegalArgumentException(\"Invalid SNMP source OID: \" + value, e);\n            }\n            String normalized = oid.toString();\n            if (!unique.add(normalized)) {\n                throw new IllegalArgumentException(\"Duplicate SNMP source OID: \" + normalized);\n            }\n            parsed.add(oid);\n        }\n        return Collections.unmodifiableList(parsed);\n    }\n\n    public List<OID> getOids() {\n        return oids;\n    }\n\n    @Override\n    public long getTimeoutMillis() {\n        return timeoutMillis;\n    }\n\n    @Override\n    public int getRetries() {\n        return retries;","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/config/SnmpSourceConfig.java#L107-L143","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\noids = [\"1.3.6.1.2.1.1.3.0\", \".1.3.6.1.2.1.1.3.0\"]\n// after\noids = [\"1.3.6.1.2.1.1.3.0\"]","handlingStrategy":"validation","validationCode":"Set<String> seen = new LinkedHashSet<>();\nfor (String oid : oids) {\n    String normalized = oid.trim().replaceFirst(\"^\\\\.\", \"\");\n    if (!seen.add(normalized)) {\n        throw new IllegalArgumentException(\"Duplicate OID after normalization: \" + normalized);\n    }\n}","typeGuard":"boolean hasNoDuplicateOids(List<String> oids) {\n    Set<String> seen = new HashSet<>();\n    for (String oid : oids) {\n        if (!seen.add(oid.trim().replaceFirst(\"^\\\\.\", \"\"))) return false;\n    }\n    return true;\n}","tryCatchPattern":"try {\n    SnmpSourceConfig cfg = new SnmpSourceConfig(config);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Duplicate SNMP source OID\")) {\n        // deduplicate the list (normalize leading dots) and rebuild the config\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["config","snmp","oid","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}