{"record":{"id":"b70c41a8736f2d42","repo":"apache/seatunnel","slug":"snmp-sink-oid-field-value-field-and-value-type-f","errorCode":null,"errorMessage":"SNMP sink oid_field, value_field, and value_type_field must be distinct","messagePattern":"SNMP sink oid_field, value_field, and value_type_field must be distinct","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":90,"sourceCode":"\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    }\n\n    @Override\n    public String getHost() {\n        return host;\n    }\n\n    @Override\n    public int getPort() {\n        return port;\n    }\n\n    @Override\n    public String getCommunity() {\n        return community;\n    }","sourceCodeStart":72,"sourceCodeEnd":108,"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#L72-L108","documentation":"validateDistinctFields ensures oid_field, value_field, and value_type_field are three different column names, since each maps to a distinct role in the SNMP PDU. If any two collide the Set size is less than 3 and an IllegalArgumentException is thrown.","triggerScenarios":"SnmpSinkConfig constructor calls validateDistinctFields(); two or more of oidField, valueField, valueTypeField hold the same column name (case differences ignored by HashSet unless identical strings).","commonSituations":"Configuring value_field = value_type_field by copy-paste; pointing all fields at one generic column like \"payload\"; schema changes collapsing columns.","solutions":["Assign three distinct column names to oid_field, value_field, and value_type_field.","Add a column to the upstream transform that carries the OID separately from the value.","Check the source schema to confirm the columns exist and differ.","Pre-validate the three field names for uniqueness before submitting the job."],"exampleFix":"// before\noid_field = \"data\"\nvalue_field = \"data\"\nvalue_type_field = \"data\"\n// after\noid_field = \"oid\"\nvalue_field = \"value\"\nvalue_type_field = \"value_type\"","handlingStrategy":"validation","validationCode":"Set<String> fields = new HashSet<>(Arrays.asList(oidField, valueField, valueTypeField)); if (fields.size() != 3) throw new IllegalArgumentException(\"oid_field, value_field and value_type_field must be distinct\");","typeGuard":null,"tryCatchPattern":"try { new SnmpSinkConfig(readonlyConfig); } catch (IllegalArgumentException e) { failFast(\"SNMP sink config invalid: \" + e.getMessage()); }","preventionTips":["Give each SNMP field role its own source column","Review sink config after upstream schema changes","Add a config lint that checks field uniqueness before job submission"],"tags":["snmp","config","validation"],"backgroundTag":"conflicting-config-options","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"}