{"record":{"id":"87491bdb6c749be1","repo":"apache/seatunnel","slug":"snmp-source-community-must-not-be-blank","errorCode":null,"errorMessage":"SNMP source community must not be blank","messagePattern":"SNMP source community must not be blank","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":68,"sourceCode":"        if (isBlank(configuredHost)) {\n            throw new IllegalArgumentException(\"SNMP source host must not be blank\");\n        }\n        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","sourceCodeStart":50,"sourceCodeEnd":86,"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#L50-L86","documentation":"The community string is the SNMPv1/v2c authentication token sent with every request; validate() throws when the configured 'community' option is null or blank because the agent would reject or the request would be meaningless without it.","triggerScenarios":"SnmpSourceConfig.validate() checks isBlank(community) after the constructor reads SnmpSourceOptions.COMMUNITY; fires when community is omitted, empty, or whitespace-only in the source config.","commonSituations":"Sanitized configs where the real community ('public' or a private one) was stripped before committing; assuming SNMPv3-style credentials (user/auth) and skipping community; copy of a v3 example used with a v2c agent that still requires community.","solutions":["Set the community string matching the agent's config, e.g. community = \"public\"","Confirm the agent actually uses SNMPv2c/v1 (community-based); for SNMPv3 this connector's validation still requires community unless a different auth mode is supported","Check for whitespace-only values or bad variable substitution"],"exampleFix":"// before\ncommunity = \"\"\n// after\ncommunity = \"public\"","handlingStrategy":"validation","validationCode":"String community = config.get(SnmpSourceOptions.COMMUNITY);\nif (community == null || community.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"SNMP 'community' is required for v1/v2c agents\");\n}","typeGuard":"boolean hasCommunity(String community) {\n    return community != null && !community.trim().isEmpty();\n}","tryCatchPattern":"try {\n    SnmpSourceConfig cfg = new SnmpSourceConfig(config);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"community must not be blank\")) {\n        // prompt for/derive the community string, e.g. default \"public\"\n    }\n    throw e;\n}","preventionTips":["Set community explicitly; do not rely on sanitized example configs","Load secrets (community strings) from a secure source, not placeholders","Confirm agent SNMP version: v1/v2c need community, v3 uses user-based auth"],"tags":["config","snmp","authentication"],"backgroundTag":"missing-required-config-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"}