{"record":{"id":"106f9274cb11e72f","repo":"apache/seatunnel","slug":"invalid-snmp-source-oid-value","errorCode":null,"errorMessage":"Invalid SNMP source OID: ${value}","messagePattern":"Invalid 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":121,"sourceCode":"            throw new IllegalArgumentException(\"SNMP source oids must not be empty\");\n        }\n\n        List<OID> parsed = new ArrayList<>(configuredOids.size());\n        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    }","sourceCodeStart":103,"sourceCodeEnd":139,"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#L103-L139","documentation":"After regex validation, parseOids() constructs an SNMP4j org.snmp4j.smi.OID from the trimmed string; if SNMP4j's OID parser throws a RuntimeException the connector wraps it in this IllegalArgumentException. This catches numerically-shaped strings that are still invalid as OIDs (e.g. segments exceeding the encoding limits).","triggerScenarios":"SnmpSourceConfig -> parseOids(): a value passes the NUMERIC_OID regex but `new OID(value)` still fails at runtime — e.g. extremely long OID strings or values with huge sub-identifiers that break SNMP4j parsing.","commonSituations":"Hand-crafted or concatenated OID strings that are syntactically dotted-numeric but semantically invalid; oversized sub-identifier values (above SNMP encoding limits); version mismatches in SNMP4j behavior.","solutions":["Verify the OID with `snmpget -v2c -c <community> <host> <oid>` before adding it to the config","Use OIDs copied directly from an MIB browser or device documentation rather than hand-built strings","Trim the OID to a valid, shorter prefix if a sub-identifier exceeds valid limits"],"exampleFix":"// before\noids = [\"1.3.6.1.2.1.1.3.0.999999999999999999999\"]\n// after\noids = [\"1.3.6.1.2.1.1.3.0\"]","handlingStrategy":"validation","validationCode":"for (String oid : oids) {\n    try {\n        new org.snmp4j.smi.OID(normalize(oid));\n    } catch (RuntimeException e) {\n        throw new IllegalArgumentException(\"Pre-flight OID check failed: \" + oid, e);\n    }\n}","typeGuard":"boolean isParsableOid(String oid) {\n    try {\n        new org.snmp4j.smi.OID(oid);\n        return true;\n    } catch (RuntimeException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    SnmpSourceConfig cfg = new SnmpSourceConfig(config);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Invalid SNMP source OID\")) {\n        // log the failing value (e.getCause() has SNMP4j's reason) and fix the config\n    }\n    throw e;\n}","preventionTips":["Test each OID with `snmpget` against the real agent before adding it","Copy OIDs from device documentation or an MIB browser, not by hand","Keep sub-identifiers within standard SNMP encoding limits"],"tags":["config","snmp","oid","parsing"],"backgroundTag":"invalid-argument-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"}