apache/seatunnel · error · IllegalArgumentException

Parameter 'type' cannot be empty.

Error message

Parameter 'type' cannot be empty.

What it means

parseSupportedPluginType validates the 'type' query parameter of the option-rules endpoint and rejects blank/empty values with this IllegalArgumentException. The endpoint cannot enumerate or guess a plugin type, so the parameter is mandatory and non-blank.

Source

Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/OptionRulesService.java:193

    }

    private LinkedHashMap<PluginIdentifier, OptionRule> getDiscoveredPlugins(
            PluginType pluginType) {
        return discoveredPluginsCache.computeIfAbsent(
                pluginType,
                key -> {
                    PluginDiscovery<?> pluginDiscovery = pluginDiscoveries.get(key);
                    if (pluginDiscovery == null) {
                        throw new IllegalArgumentException(
                                String.format("Unsupported plugin type: %s", pluginType.getType()));
                    }
                    return pluginDiscovery.getPlugins();
                });
    }

    private PluginType parseSupportedPluginType(String pluginTypeText) {
        if (StringUtils.isBlank(pluginTypeText)) {
            throw new IllegalArgumentException(
                    String.format("Parameter '%s' cannot be empty.", PARAM_TYPE));
        }
        String normalizedPluginType = pluginTypeText.trim();
        if (StringUtils.equalsIgnoreCase(normalizedPluginType, PluginType.SOURCE.getType())) {
            return PluginType.SOURCE;
        }
        if (StringUtils.equalsIgnoreCase(normalizedPluginType, PluginType.SINK.getType())) {
            return PluginType.SINK;
        }
        if (StringUtils.equalsIgnoreCase(normalizedPluginType, PluginType.TRANSFORM.getType())) {
            return PluginType.TRANSFORM;
        }
        throw new IllegalArgumentException(
                String.format(
                        "Unsupported plugin type '%s'. Only '%s', '%s' and '%s' are supported.",
                        normalizedPluginType,
                        PluginType.SOURCE.getType(),
                        PluginType.SINK.getType(),

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Append a valid type query parameter: ?type=source (or sink / transform).
  2. In client code, default the type explicitly or validate it is non-blank before building the URL.
  3. If multiple types are wanted, issue one request per supported type instead of omitting type.

Example fix

// before
curl 'http://host:8080/option-rules?type='
// after
curl 'http://host:8080/option-rules?type=source'
Defensive patterns

Strategy: validation

Validate before calling

if (typeof type !== "string" || !type.trim()) throw new Error("option-rules requires a non-empty 'type' parameter");

Type guard

function isValidPluginTypeParam(v) {
  return typeof v === "string" && v.trim().length > 0;
}

Try / catch

try { fetchOptionRules(type); } catch (IllegalArgumentException e) { if (e.getMessage().includes("cannot be empty")) { fetchOptionRules("source"); } else throw e; }

Prevention

When it happens

Trigger: GET /option-rules with no type parameter, an empty type=, or a whitespace-only value (StringUtils.isBlank check).

Common situations: Hand-built URLs missing the query parameter; client code passing a null/empty variable for type; template strings where the type placeholder was not substituted.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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