apache/seatunnel · error · java.lang.IllegalArgumentException

Duration value cannot be blank.

Error message

Duration value cannot be blank.

What it means

Thrown from ConfigUtil.convertToDuration when a Duration-typed option is given a value that is empty or only whitespace after trimming. This is a guard at the start of duration parsing: the user supplied an option key with an empty string (e.g. timeout=""), and no duration can be derived from it, distinct from the later parse failure for malformed non-empty text.

Solutions

  1. Provide an actual duration value for the option, e.g. 10S or PT10S
  2. Remove the option key entirely if empty is meant to mean 'use the default'
  3. Check for an empty environment-variable substitution or templating placeholder that resolved to ""
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/ConfigUtil.java:189 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/ConfigUtil.java:189

    static Double convertToDouble(Object o) {
        if (o.getClass() == Double.class) {
            return (Double) o;
        } else if (o.getClass() == Float.class) {
            return ((Float) o).doubleValue();
        }

        return Double.parseDouble(o.toString());
    }

    static Duration convertToDuration(Object o) {
        if (o instanceof Duration) {
            return (Duration) o;
        }

        String value = o.toString().trim();
        if (value.isEmpty()) {
            throw new IllegalArgumentException("Duration value cannot be blank.");
        }

        // Prefer shorthand format first to match connector docs, e.g. 10S / 500MS.
        String normalized = value.replaceAll("\\s+", "").toUpperCase(Locale.ROOT);
        Duration shorthandDuration = tryParseShorthandDuration(normalized);
        if (shorthandDuration != null) {
            return shorthandDuration;
        }

        // Fallback to ISO-8601 duration format, e.g. PT10S.
        try {
            return Duration.parse(value);
        } catch (Exception e) {
            throw new IllegalArgumentException(
                    String.format(
                            "Could not parse duration value '%s'. Supported formats: shorthand (e.g. 10S, 500MS) or ISO-8601 (e.g. PT10S).",
                            value),
                    e);

View on GitHub (pinned to cf67b549a7)