apache/seatunnel · error · IllegalArgumentException

SNMP sink ${optionName} must not be blank

Error message

SNMP sink ${optionName} must not be blank

What it means

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".

Source

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

    private void validateTarget() {
        if (port < 1 || port > 65535) {
            throw new IllegalArgumentException("SNMP sink port must be between 1 and 65535");
        }
        if (isBlank(community)) {
            throw new IllegalArgumentException("SNMP sink community must not be blank");
        }
        if (timeoutMillis <= 0) {
            throw new IllegalArgumentException("SNMP sink timeout_millis must be greater than 0");
        }
        if (retries < 0) {
            throw new IllegalArgumentException("SNMP sink retries must not be negative");
        }
    }

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

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Provide values for all three required fields: oid_field, value_field, and value_type_field.
  2. Ensure the configured field names exactly match columns in the upstream dataset.
  3. Check for typo'd option names so the values are actually read from the config.
  4. Trim whitespace from values; the helper rejects whitespace-only strings.

Example fix

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

Strategy: validation

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: SnmpSinkConfig constructor calls requireField for oid_field, value_field, or value_type_field; the corresponding option in ReadonlyConfig is null, empty, or whitespace-only.

Common situations: 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.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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