apache/seatunnel · error · IllegalArgumentException

Unsupported auth type:

Error message

Unsupported auth type: 

What it means

AuthTypeEnum.fromValue throws an IllegalArgumentException when the given string does not match any known auth type value (basic, api_key, api_key_encoded). It is a strict config-parsing guard so invalid auth_type strings fail early with a clear message instead of silently misbehaving.

Source

Thrown at seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/config/AuthTypeEnum.java:53

    public String getValue() {
        return value;
    }

    /**
     * Get AuthTypeEnum from string value.
     *
     * @param value the string value
     * @return the corresponding AuthTypeEnum
     * @throws IllegalArgumentException if the value is not supported
     */
    public static AuthTypeEnum fromValue(String value) {
        for (AuthTypeEnum authType : values()) {
            if (authType.getValue().equals(value)) {
                return authType;
            }
        }
        throw new IllegalArgumentException("Unsupported auth type: " + value);
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set auth_type to exactly one of: basic, api_key, api_key_encoded (lowercase, no spaces)
  2. Remove leading/trailing whitespace or quotes issues in the config file
  3. If you need another mechanism (e.g., bearer token), it is unsupported — use api_key or upgrade SeaTunnel

Example fix

// before
"auth_type": "API_KEY"
// after
"auth_type": "api_key"
Defensive patterns

Strategy: validation

Validate before calling

// Normalize and validate before conversion:
String v = rawAuthType == null ? "basic" : rawAuthType.trim().toLowerCase(Locale.ROOT);
if (!List.of("basic","api_key","api_key_encoded").contains(v)) {
    throw new IllegalArgumentException("auth_type must be one of basic|api_key|api_key_encoded, got: " + rawAuthType);
}

Type guard

boolean isValidAuthType(String v) {
    return v != null && (v.equals("basic") || v.equals("api_key") || v.equals("api_key_encoded"));
}

Try / catch

try {
    AuthTypeEnum t = AuthTypeEnum.fromValue(rawAuthType.trim());
} catch (IllegalArgumentException e) {
    throw new IllegalArgumentException("Unsupported auth_type '" + rawAuthType + "'; use basic, api_key, or api_key_encoded", e);
}

Prevention

When it happens

Trigger: Calling AuthTypeEnum.fromValue (or any config parsing path that uses it) with an auth_type string that is not exactly one of 'basic', 'api_key', or 'api_key_encoded'.

Common situations: Typos like 'apikey', 'API_KEY', 'basic-auth'; case sensitivity (values are lowercase); copying auth types from other connectors (e.g., 'bearer', 'jwt'); trailing whitespace in YAML/HOCON values.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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