apache/dolphinscheduler · error · CronParseException

Parse corn expression: [%s] error

Error message

Parse corn expression: [%s] error

What it means

The Quartz-flavoured cron expression could not be parsed by the cron-parser library — the expression violates Quartz cron syntax (wrong field count, out-of-range values, illegal characters like 'L'/'W' in unsupported positions, or an empty/null string). IllegalArgumentException from the parser is caught and rethrown as CronParseException with a formatted message naming the offending expression.

Source

Thrown at dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/cron/CronUtils.java:77

    private CronUtils() {
        throw new IllegalStateException("CronUtils class");
    }

    private static final CronParser QUARTZ_CRON_PARSER =
            new CronParser(CronDefinitionBuilder.instanceDefinitionFor(QUARTZ));

    /**
     * parse to cron
     *
     * @param cronExpression cron expression, never null
     * @return Cron instance, corresponding to cron expression received
     */
    public static Cron parse2Cron(String cronExpression) throws CronParseException {
        try {
            return QUARTZ_CRON_PARSER.parse(cronExpression);
        } catch (IllegalArgumentException ex) {
            throw new CronParseException(String.format("Parse corn expression: [%s] error", cronExpression), ex);
        }
    }

    /**
     * Indicates whether the specified cron expression can be parsed into a
     * valid cron expression
     *
     * @param cronExpression the expression to evaluate
     * @return a boolean indicating whether the given expression is a valid cron
     *         expression
     */
    public static boolean isValidExpression(String cronExpression) {
        try {
            parse2Cron(cronExpression);
        } catch (CronParseException e) {
            return false;
        }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Correct the expression to Quartz 6/7-field syntax (second minute hour day-of-month month day-of-week [year])
  2. Validate via CronUtils.isValidExpression before saving the schedule so the UI rejects it early
  3. Ensure day-of-month and day-of-week are not both restricted (Quartz requires one to be '?')
  4. Check parameter placeholder substitution did not leave ${...} tokens in the cron string
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/cron/CronUtils.java:77 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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