{"record":{"id":"28e60f4280a9b09d","repo":"apache/seatunnel","slug":"snmp-sink-optionname-must-not-be-blank","errorCode":null,"errorMessage":"SNMP sink ${optionName} must not be blank","messagePattern":"SNMP sink (.+?) 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":75,"sourceCode":"\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() {\n        Set<String> fields = new HashSet<>();\n        fields.add(oidField);\n        fields.add(valueField);\n        fields.add(valueTypeField);\n        if (fields.size() != 3) {\n            throw new IllegalArgumentException(\n                    \"SNMP sink oid_field, value_field, and value_type_field must be distinct\");\n        }\n    }","sourceCodeStart":57,"sourceCodeEnd":93,"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#L57-L93","documentation":"requireField is a shared helper enforcing that a required string field option is present and non-blank, trimming and returning it. If the field is blank it throws an IllegalArgumentException naming the option, e.g. \"SNMP sink oid_field must not be blank\".","triggerScenarios":"SnmpSinkConfig constructor calls requireField for oid_field, value_field, or value_type_field; the corresponding option in ReadonlyConfig is null, empty, or whitespace-only.","commonSituations":"Forgetting to map source columns to oid_field/value_field/value_type_field; renaming columns upstream so the configured field no longer matches; copying a template with empty placeholders.","solutions":["Provide values for all three required fields: oid_field, value_field, and value_type_field.","Ensure the configured field names exactly match columns in the upstream dataset.","Check for typo'd option names so the values are actually read from the config.","Trim whitespace from values; the helper rejects whitespace-only strings."],"exampleFix":"// before\noid_field = \"\"\n// after\noid_field = \"oid\"\nvalue_field = \"value\"\nvalue_type_field = \"value_type\"","handlingStrategy":"validation","validationCode":"for (String f : new String[]{oidField, valueField, valueTypeField}) { if (f == null || f.trim().isEmpty()) throw new IllegalArgumentException(\"SNMP sink field options must all be set\"); }","typeGuard":null,"tryCatchPattern":"try { new SnmpSinkConfig(readonlyConfig); } catch (IllegalArgumentException e) { failFast(\"SNMP sink field missing: \" + e.getMessage()); }","preventionTips":["Set oid_field, value_field, and value_type_field explicitly in every sink config","Keep upstream column names in sync with the configured fields","Trim whitespace from config values"],"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"}