apache/seatunnel · error · IllegalArgumentException

Invalid error handler boolean value for

Error message

Invalid error handler boolean value for '%s': %s

What it means

ErrorHandlerConfigUtil.getBoolean parses an error-handler option as a boolean. Only exact 'true' or 'false' (case-insensitive) are accepted; any other string throws IllegalArgumentException naming the key and offending value. This prevents ambiguous truthy values in error-handler configuration.

Solutions

  1. Change the value to literal 'true' or 'false' (any letter case).
  2. Strip surrounding whitespace/quotes from the value in the config file.
  3. If generating config programmatically, convert language-native booleans to 'true'/'false' strings before inserting.

Example fix

// before
includeStacktrace = "yes"
// after
includeStacktrace = "true"
Defensive patterns

Strategy: validation

Validate before calling

Object v = cfg.get("includeStacktrace");
if (v != null && !(v instanceof Boolean)
        && !"true".equalsIgnoreCase(v.toString())
        && !"false".equalsIgnoreCase(v.toString())) {
    throw new IllegalArgumentException("includeStacktrace must be true/false, got: " + v);
}

Type guard

boolean isValidBoolean(Object v) {
    return v instanceof Boolean
        || (v != null && ("true".equalsIgnoreCase(v.toString()) || "false".equalsIgnoreCase(v.toString())));
}

Try / catch

try {
    boolean b = ErrorHandlerConfigUtil.includeStacktrace(...);
} catch (IllegalArgumentException e) {
    log.error("Bad boolean config: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling getBoolean (via includeStacktrace or includeOriginalData) with values like 'yes', '1', 'on', 'TRUE ' with trailing whitespace is fine only for case, but 'yes'/'1'/'on' throw.

Common situations: Users coming from YAML/JSON habits set 'include-stacktrace: yes' or 'includeOriginalData = 1', both of which are rejected.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/error/ErrorHandlerConfigUtil.java:242

    private static boolean getBoolean(
            Map<String, Object> stage,
            Map<String, Object> global,
            String key,
            boolean defaultValue) {
        Object value = stage.getOrDefault(key, global.get(key));
        if (value instanceof Boolean) {
            return (Boolean) value;
        }
        if (value != null) {
            String booleanValue = value.toString().trim();
            if ("true".equalsIgnoreCase(booleanValue)) {
                return true;
            }
            if ("false".equalsIgnoreCase(booleanValue)) {
                return false;
            }
            throw new IllegalArgumentException(
                    "Invalid error handler boolean value for '" + key + "': " + value);
        }
        return defaultValue;
    }

    private static int getNonNegativeInt(
            Map<String, Object> stage, Map<String, Object> global, String key, int defaultValue) {
        long value = getLong(stage, global, key, defaultValue);
        if (value < 0 || value > Integer.MAX_VALUE) {
            throw new IllegalArgumentException(
                    "error handler "
                            + key
                            + " must be between 0 and "
                            + Integer.MAX_VALUE
                            + ", but was "
                            + value);
        }
        return (int) value;

View on GitHub (pinned to cf67b549a7)