{"record":{"id":"4951f4487634ebf7","repo":"apache/seatunnel","slug":"snmp-source-timeout-millis-must-be-greater-than-0","errorCode":null,"errorMessage":"SNMP source timeout_millis must be greater than 0","messagePattern":"SNMP source 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/SnmpSourceConfig.java","lineNumber":71,"sourceCode":"        this.host = configuredHost.trim();\n        this.port = config.get(SnmpSourceOptions.PORT);\n        this.community = config.get(SnmpSourceOptions.COMMUNITY);\n        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    }","sourceCodeStart":53,"sourceCodeEnd":89,"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#L53-L89","documentation":"validate() requires the per-request SNMP timeout to be strictly positive. The timeout_millis option bounds how long each SNMP request waits for a response; zero or negative values would cause immediate failures or undefined behavior in SNMP4j.","triggerScenarios":"SnmpSourceConfig constructor reads SnmpSourceOptions.TIMEOUT_MILLIS then validate() throws when timeoutMillis <= 0 — e.g. timeout_millis = 0 or a negative number in the config.","commonSituations":"Setting timeout_millis = 0 intending 'no timeout'; unit confusion (writing seconds value expecting it passes a sanity check, e.g. -1 as 'infinite'); fat-fingering a negative number.","solutions":["Set timeout_millis to a positive value, e.g. timeout_millis = 1500 (default range is typically 1000-5000ms)","Remove the option to use the connector's default timeout if one is defined in SnmpSourceOptions"],"exampleFix":"// before\ntimeout_millis = 0\n// after\ntimeout_millis = 1500","handlingStrategy":"validation","validationCode":"Integer timeout = config.get(SnmpSourceOptions.TIMEOUT_MILLIS);\nif (timeout == null || timeout <= 0) {\n    throw new IllegalArgumentException(\"timeout_millis must be > 0\");\n}","typeGuard":"boolean isValidTimeout(Integer timeoutMillis) {\n    return timeoutMillis != null && timeoutMillis > 0;\n}","tryCatchPattern":"try {\n    SnmpSourceConfig cfg = new SnmpSourceConfig(config);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"timeout_millis must be greater than 0\")) {\n        // fall back to a sane default like 1500ms\n    }\n    throw e;\n}","preventionTips":["Use millisecond units consistently; 1000-5000ms is a typical range","Omit the option to use the connector default rather than setting 0","Never use 0 or -1 as 'no timeout' sentinels here"],"tags":["config","snmp","timeout"],"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"}