quarkusio/quarkus · error · IllegalStateException

Unsupported cron type:

Error message

Unsupported cron type: 

What it means

CronParser.mapToQuartz() translates cron expressions from various cron dialects (identified by CronType) into Quartz format using cron-utils. When the given CronType has no mapping branch in the switch, this IllegalStateException is thrown with the unsupported type appended. It indicates an internal/unknown cron dialect rather than a bad user expression.

Source

Thrown at extensions/scheduler/common/src/main/java/io/quarkus/scheduler/common/runtime/CronParser.java:56

    public Cron mapToQuartz(Cron cron) {
        switch (cronType) {
            case QUARTZ:
                return cron;
            case UNIX:
                return CronMapper.fromUnixToQuartz().map(cron);
            case CRON4J:
                return CronMapper.fromCron4jToQuartz().map(cron);
            case SPRING:
                return CronMapper.fromSpringToQuartz().map(cron);
            case SPRING53:
                // https://github.com/jmrozanec/cron-utils/issues/579
                return new CronMapper(
                        CronDefinitionBuilder.instanceDefinitionFor(CronType.SPRING53),
                        CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ),
                        setQuestionMark()).map(cron);
            default:
                throw new IllegalStateException("Unsupported cron type: " + cronType);
        }
    }

    // Copy from com.cronutils.mapper.CronMapper#setQuestionMark()
    private static Function<Cron, Cron> setQuestionMark() {
        return cron -> {
            final CronField dow = cron.retrieve(CronFieldName.DAY_OF_WEEK);
            final CronField dom = cron.retrieve(CronFieldName.DAY_OF_MONTH);
            if (dow == null && dom == null) {
                return cron;
            }
            if (dow.getExpression() instanceof QuestionMark || dom.getExpression() instanceof QuestionMark) {
                return cron;
            }
            final Map<CronFieldName, CronField> fields = new EnumMap<>(CronFieldName.class);
            fields.putAll(cron.retrieveFieldsAsMap());
            if (dow.getExpression() instanceof Always) {
                fields.put(CronFieldName.DAY_OF_WEEK,

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use a cron expression in a supported dialect (Quartz or one of the mapped types) in @Scheduled/scheduler config
  2. Check the CronParser switch and add a mapping branch if you control the code and need a new CronType
  3. Normalize the expression to Quartz format before calling the parser
  4. Verify the cron-utils dependency version matches what Quarkus expects

Example fix

// before
CronParser.mapToQuartz(CronType.CRON4J_UNKNOWN, expr); // unsupported
// after
CronParser.mapToQuartz(CronType.UNIX, "0 12 * * *") or use Quartz syntax directly
Defensive patterns

Strategy: try-catch

Validate before calling

// restrict config to supported dialects
if (!Set.of("QUARTZ","UNIX","SPRING","SPRING53","CRON4J").contains(dialect)) {
    throw new IllegalArgumentException("unsupported cron dialect: " + dialect);
}

Try / catch

try {
    cron = CronParser.mapToQuartz(cronType, expression);
} catch (IllegalStateException e) {
    LOG.error("Unsupported cron type {} - use a mapped dialect", cronType, e);
    throw new ConfigurationException("Unsupported cron dialect", e);
}

Prevention

When it happens

Trigger: Calling CronParser.mapToQuartz(cronType, cron) with a CronType not handled by the switch (only specific types like SPRING, SPRING53, UNIX, CRON4J etc. are mapped); passing null; library upgrade introducing a new CronType not yet mapped.

Common situations: Custom scheduler configs referencing a cron dialect the Quarkus mapping doesn't support; passing a parsed Cron object's type that differs from the supported set; cron-utils version change adding new enum values.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/1007bdc49ec6409f. Report an issue: GitHub.