{"record":{"id":"4c23c96a6801446d","repo":"apache/seatunnel","slug":"snmp-sink-community-must-not-be-blank","errorCode":null,"errorMessage":"SNMP sink community must not be blank","messagePattern":"SNMP sink 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/SnmpSinkConfig.java","lineNumber":63,"sourceCode":"        this.host = configuredHost.trim();\n        this.port = config.get(SnmpSinkOptions.PORT);\n        this.community = config.get(SnmpSinkOptions.COMMUNITY);\n        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();","sourceCodeStart":45,"sourceCodeEnd":81,"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#L45-L81","documentation":"validateTarget requires a non-blank SNMP community string (the v2c 'password'). A missing or blank community makes every request fail authentication, so the config constructor throws IllegalArgumentException early.","triggerScenarios":"SnmpSinkConfig constructor calls validateTarget(); the COMMUNITY option is null, empty, or whitespace-only.","commonSituations":"Omitting `community` in the sink config; assuming a default community that the connector does not provide; the agent's community differs and was left blank to 'inherit'.","solutions":["Add `community = \"public\"` (or the agent's actual community string) to the sink config.","Confirm the SNMP agent's community name (default often \"public\" for read-only).","Never leave community blank for v2c targets; it is required.","Pre-check config.get(SnmpSinkOptions.COMMUNITY) before building the sink."],"exampleFix":"// before\nSnmp {\n  sink = {\n    host = \"192.168.1.50\"\n    port = 161\n  }\n}\n// after\nSnmp {\n  sink = {\n    host = \"192.168.1.50\"\n    port = 161\n    community = \"public\"\n  }\n}","handlingStrategy":"validation","validationCode":"String community = config.get(SnmpSinkOptions.COMMUNITY); if (community == null || community.trim().isEmpty()) throw new IllegalArgumentException(\"community is required for SNMP sink\");","typeGuard":null,"tryCatchPattern":"try { new SnmpSinkConfig(readonlyConfig); } catch (IllegalArgumentException e) { failFast(\"SNMP sink config invalid: \" + e.getMessage()); }","preventionTips":["Always configure the community string for v2c targets","Confirm the agent's community (often \"public\" for read-only)","Store the community in secure config, never hardcode in shared templates"],"tags":["snmp","config","validation"],"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-14T11:17:12.474Z"}