apache/dolphinscheduler · error · IllegalArgumentException

data: %s should be a validate data string - yyyy-MM-dd HH:mm

Error message

data: %s should be a validate data string - yyyy-MM-dd HH:mm:ss 

What it means

DateUtils.stringToZoneDateTime first parses the input via stringToDate; if parsing fails it returns null, and this method then throws IllegalArgumentException with a formatted message showing the offending input and the expected pattern yyyy-MM-dd HH:mm:ss. It converts a validated date string into a ZonedDateTime in the system default zone.

Source

Thrown at dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java:231

            log.error("error while parse date:" + date, e);
        }
        return null;
    }

    /**
     * convert date str to yyyy-MM-dd HH:mm:ss format
     *
     * @param date date string
     * @return yyyy-MM-dd HH:mm:ss format
     */
    public static @Nullable Date stringToDate(String date) {
        return parse(date, YYYY_MM_DD_HH_MM_SS, null);
    }

    public static ZonedDateTime stringToZoneDateTime(@Nonnull String date) {
        Date d = stringToDate(date);
        if (d == null) {
            throw new IllegalArgumentException(String.format(
                    "data: %s should be a validate data string - yyyy-MM-dd HH:mm:ss ",
                    date));
        }
        return ZonedDateTime.ofInstant(d.toInstant(), ZoneId.systemDefault());
    }

    /**
     * convert date str to yyyy-MM-dd HH:mm:ss format
     *
     * @param date     date string
     * @param timezone
     * @return yyyy-MM-dd HH:mm:ss format
     */
    public static Date stringToDate(String date, String timezone) {
        return parse(date, YYYY_MM_DD_HH_MM_SS, timezone);
    }

    /**

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Format the input as "yyyy-MM-dd HH:mm:ss" before calling (e.g. "2024-01-01 10:00:00")
  2. If the value is an epoch timestamp, convert with DateUtils.timestampToTimeZone/timestampToDate first instead of passing the raw number string
  3. If the value is ISO-8601 with 'T', normalize: date.replace('T', ' ') and strip milliseconds/zone suffix, or parse it with java.time directly
  4. Add a pre-check with DateUtils.stringToDate(date) != null before invoking stringToZoneDateTime to produce a clearer upstream error

Example fix

// before
ZonedDateTime zdt = DateUtils.stringToZoneDateTime("2024-01-01T10:00:00");

// after
String normalized = input.replace('T', ' ').split("\\.")[0];
ZonedDateTime zdt = DateUtils.stringToZoneDateTime(normalized); // "2024-01-01 10:00:00"
Defensive patterns

Strategy: validation

Validate before calling

boolean isValidDateInput(String s) {
    return s != null && s.matches("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}") && DateUtils.stringToDate(s) != null;
}

Try / catch

try {
    ZonedDateTime zdt = DateUtils.stringToZoneDateTime(input);
} catch (IllegalArgumentException e) {
    log.error("Bad date input '{}': expected yyyy-MM-dd HH:mm:ss", input);
}

Prevention

When it happens

Trigger: Calling stringToZoneDateTime with null-format data: an empty string, a string not matching "yyyy-MM-dd HH:mm:ss" (e.g. ISO with T and milliseconds "2024-01-01T10:00:00", date-only "2024-01-01", or a timestamp number as string), or a @Nonnull-annotated null argument.

Common situations: Workflow parameter/timing values pasted from the UI in a different locale format; frontend sending ISO-8601 strings; schedule start/end times stored as epoch millis being passed directly; user-defined dependent-task date parameters with typos.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/5f7d10583d68fa56. Report an issue: GitHub.