apache/seatunnel · error · IllegalArgumentException

SNMP sink oid_field, value_field, and value_type_field must…

Error message

SNMP sink oid_field, value_field, and value_type_field must be distinct

What it means

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.

Solutions

  1. Assign three distinct column names to oid_field, value_field, and value_type_field.
  2. Add a column to the upstream transform that carries the OID separately from the value.
  3. Check the source schema to confirm the columns exist and differ.
  4. Pre-validate the three field names for uniqueness before submitting the job.

Example fix

// before
oid_field = "data"
value_field = "data"
value_type_field = "data"
// after
oid_field = "oid"
value_field = "value"
value_type_field = "value_type"
Defensive patterns

Strategy: validation

Validate before calling

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");

Try / catch

try { new SnmpSinkConfig(readonlyConfig); } catch (IllegalArgumentException e) { failFast("SNMP sink config invalid: " + e.getMessage()); }

Prevention

When it happens

Trigger: SnmpSinkConfig constructor calls validateDistinctFields(); two or more of oidField, valueField, valueTypeField hold the same column name (case differences ignored by HashSet unless identical strings).

Common situations: Configuring value_field = value_type_field by copy-paste; pointing all fields at one generic column like "payload"; schema changes collapsing columns.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/b70c41a8736f2d42. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-snmp/src/main/java/org/apache/seatunnel/connectors/seatunnel/snmp/config/SnmpSinkConfig.java:90

    private static String requireField(String configuredField, String optionName) {
        if (isBlank(configuredField)) {
            throw new IllegalArgumentException("SNMP sink " + optionName + " must not be blank");
        }
        return configuredField.trim();
    }

    private static boolean isBlank(String value) {
        return value == null || value.trim().isEmpty();
    }

    private void validateDistinctFields() {
        Set<String> fields = new HashSet<>();
        fields.add(oidField);
        fields.add(valueField);
        fields.add(valueTypeField);
        if (fields.size() != 3) {
            throw new IllegalArgumentException(
                    "SNMP sink oid_field, value_field, and value_type_field must be distinct");
        }
    }

    @Override
    public String getHost() {
        return host;
    }

    @Override
    public int getPort() {
        return port;
    }

    @Override
    public String getCommunity() {
        return community;
    }

View on GitHub (pinned to cf67b549a7)