{"record":{"id":"ab5764a6d3d611a1","repo":"apache/seatunnel","slug":"snmp-source-oids-must-not-be-empty","errorCode":null,"errorMessage":"SNMP source oids must not be empty","messagePattern":"SNMP source oids must not be empty","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":103,"sourceCode":"\n    @Override\n    public String getHost() {\n        return host;\n    }\n\n    @Override\n    public int getPort() {\n        return port;\n    }\n\n    @Override\n    public String getCommunity() {\n        return community;\n    }\n\n    private static List<OID> parseOids(List<String> configuredOids) {\n        if (configuredOids == null || configuredOids.isEmpty()) {\n            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);","sourceCodeStart":85,"sourceCodeEnd":121,"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#L85-L121","documentation":"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.","triggerScenarios":"SnmpSourceConfig constructor calls parseOids(config.get(SnmpSourceOptions.OIDS)); fires when the oids option is omitted entirely or set to an empty list (oids = []).","commonSituations":"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.","solutions":["Provide at least one OID, e.g. oids = [\"1.3.6.1.2.1.1.3.0\"]","Verify the upstream data feeding the oids list is non-empty before rendering the config"],"exampleFix":"// before\noids = []\n// after\noids = [\"1.3.6.1.2.1.1.3.0\", \"1.3.6.1.2.1.2.2.1.10.1\"]","handlingStrategy":"validation","validationCode":"List<String> oids = config.get(SnmpSourceOptions.OIDS);\nif (oids == null || oids.isEmpty()) {\n    throw new IllegalArgumentException(\"SNMP 'oids' must contain at least one OID\");\n}","typeGuard":"boolean hasOids(List<String> oids) {\n    return oids != null && !oids.isEmpty();\n}","tryCatchPattern":"try {\n    SnmpSourceConfig cfg = new SnmpSourceConfig(config);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"oids must not be empty\")) {\n        // abort job or inject a default OID set before re-submitting\n    }\n    throw e;\n}","preventionTips":["Always list at least one OID in the source config","When generating configs from upstream data, assert the OID list is non-empty","Keep a canonical set of monitored OIDs in version control as the source of truth"],"tags":["config","snmp","validation"],"backgroundTag":"empty-required-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}