{"record":{"id":"732714851471a8a0","repo":"apache/seatunnel","slug":"snmp-source-retries-must-not-be-negative","errorCode":null,"errorMessage":"SNMP source retries must not be negative","messagePattern":"SNMP source retries must not be negative","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":74,"sourceCode":"        this.oids = parseOids(config.get(SnmpSourceOptions.OIDS));\n        this.timeoutMillis = config.get(SnmpSourceOptions.TIMEOUT_MILLIS);\n        this.retries = config.get(SnmpSourceOptions.RETRIES);\n        this.pollIntervalMillis = config.get(SnmpSourceOptions.POLL_INTERVAL_MILLIS);\n        validate();\n    }\n\n    private void validate() {\n        if (port < 1 || port > 65535) {\n            throw new IllegalArgumentException(\"SNMP source port must be between 1 and 65535\");\n        }\n        if (isBlank(community)) {\n            throw new IllegalArgumentException(\"SNMP source community must not be blank\");\n        }\n        if (timeoutMillis <= 0) {\n            throw new IllegalArgumentException(\"SNMP source timeout_millis must be greater than 0\");\n        }\n        if (retries < 0) {\n            throw new IllegalArgumentException(\"SNMP source retries must not be negative\");\n        }\n        if (pollIntervalMillis <= 0) {\n            throw new IllegalArgumentException(\n                    \"SNMP source poll_interval_millis must be greater than 0\");\n        }\n    }\n\n    private static boolean isBlank(String value) {\n        return value == null || value.trim().isEmpty();\n    }\n\n    @Override\n    public String getHost() {\n        return host;\n    }\n\n    @Override\n    public int getPort() {","sourceCodeStart":56,"sourceCodeEnd":92,"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#L56-L92","documentation":"This is a config-validation error thrown by the SnmpSourceConfig.validate() guard during construction of the SNMP source options. It fires when the user-provided value for the retries option (SnmpSourceOptions.RETRIES) is a negative number; the fix is to supply a non-negative integer retry count in the source configuration.","triggerScenarios":"SnmpSourceConfig.validate() throws when the configured SnmpSourceOptions.RETRIES value is < 0, e.g. retries = -1 intended to disable retrying.","commonSituations":"Using -1 to mean 'infinite retries' or 'disabled' by habit from other libraries; sign typo in the config file.","solutions":["Set retries to 0 to disable retries, or a small positive number like 1-3","Remove the retries option to use the connector default"],"exampleFix":"// before\nretries = -1\n// after\nretries = 2","handlingStrategy":"validation","validationCode":"Integer retries = config.get(SnmpSourceOptions.RETRIES);\nif (retries == null || retries < 0) {\n    throw new IllegalArgumentException(\"retries must be >= 0\");\n}","typeGuard":"boolean isValidRetries(Integer retries) {\n    return retries != null && retries >= 0;\n}","tryCatchPattern":"try {\n    SnmpSourceConfig cfg = new SnmpSourceConfig(config);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"retries must not be negative\")) {\n        // clamp to 0 or a small positive value and retry config construction\n    }\n    throw e;\n}","preventionTips":["Use 0 to disable retries, not -1","Keep retry counts small (0-3) to avoid long stalls on unreachable agents","Validate sign of all numeric options before job submission"],"tags":["config","snmp","validation"],"backgroundTag":"value-out-of-range","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"}