{"record":{"id":"b0d6a9453c67c8e9","repo":"apache/seatunnel","slug":"snmp-sink-timeout-millis-must-be-greater-than-0","errorCode":null,"errorMessage":"SNMP sink timeout_millis must be greater than 0","messagePattern":"SNMP sink timeout_millis must be greater than 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/config/SnmpSinkConfig.java","lineNumber":66,"sourceCode":"        this.timeoutMillis = config.get(SnmpSinkOptions.TIMEOUT_MILLIS);\n        this.retries = config.get(SnmpSinkOptions.RETRIES);\n        this.oidField = requireField(config.get(SnmpSinkOptions.OID_FIELD), \"oid_field\");\n        this.valueField = requireField(config.get(SnmpSinkOptions.VALUE_FIELD), \"value_field\");\n        this.valueTypeField =\n                requireField(config.get(SnmpSinkOptions.VALUE_TYPE_FIELD), \"value_type_field\");\n        validateTarget();\n        validateDistinctFields();\n    }\n\n    private void validateTarget() {\n        if (port < 1 || port > 65535) {\n            throw new IllegalArgumentException(\"SNMP sink port must be between 1 and 65535\");\n        }\n        if (isBlank(community)) {\n            throw new IllegalArgumentException(\"SNMP sink community must not be blank\");\n        }\n        if (timeoutMillis <= 0) {\n            throw new IllegalArgumentException(\"SNMP sink timeout_millis must be greater than 0\");\n        }\n        if (retries < 0) {\n            throw new IllegalArgumentException(\"SNMP sink retries must not be negative\");\n        }\n    }\n\n    private static String requireField(String configuredField, String optionName) {\n        if (isBlank(configuredField)) {\n            throw new IllegalArgumentException(\"SNMP sink \" + optionName + \" must not be blank\");\n        }\n        return configuredField.trim();\n    }\n\n    private static boolean isBlank(String value) {\n        return value == null || value.trim().isEmpty();\n    }\n\n    private void validateDistinctFields() {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/config/SnmpSinkConfig.java#L48-L84","documentation":"validateTarget checks that the SNMP request timeout is positive. A zero or negative timeout_millis would make the SNMP request either immediate or invalid, so the config constructor throws IllegalArgumentException.","triggerScenarios":"SnmpSinkConfig constructor calls validateTarget(); TIMEOUT_MILLIS option resolves to 0 or a negative number.","commonSituations":"Setting timeout_millis = 0 to mean 'no timeout'; unit confusion (seconds entered where millis expected yields e.g. 2 vs 2000 — negative only from explicit bad input); template placeholders left as 0.","solutions":["Set timeout_millis to a positive value, e.g. 1000–5000 ms.","Remove an explicit 0 to use the option's default value if one exists.","Confirm the value is in milliseconds, not seconds.","Pre-validate timeout > 0 before constructing the sink config."],"exampleFix":"// before\ntimeout_millis = 0\n// after\ntimeout_millis = 2000","handlingStrategy":"validation","validationCode":"int timeout = config.get(SnmpSinkOptions.TIMEOUT_MILLIS); if (timeout <= 0) throw new IllegalArgumentException(\"timeout_millis must be > 0\");","typeGuard":null,"tryCatchPattern":"try { new SnmpSinkConfig(readonlyConfig); } catch (IllegalArgumentException e) { failFast(\"SNMP sink config invalid: \" + e.getMessage()); }","preventionTips":["Use a sane timeout like 1000-5000 ms","Remember the unit is milliseconds","Omit the option to use the default rather than setting 0"],"tags":["snmp","config","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-14T11:17:12.474Z"}