{"record":{"id":"fb2518162c6c92fe","repo":"flowable/flowable-engine","slug":"support-for-specifying-multiple-nth-days-is-not","errorCode":null,"errorMessage":"Support for specifying multiple \"nth\" days is not implemented.","messagePattern":"Support for specifying multiple \"nth\" days is not implemented\\.","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/calendar/CronExpression.java","lineNumber":503,"sourceCode":"\n            StringTokenizer exprsTok = new StringTokenizer(expression, \" \\t\", false);\n\n            while (exprsTok.hasMoreTokens() && exprOn <= YEAR) {\n                String expr = exprsTok.nextToken().trim();\n\n                // throw an exception if L is used with other days of the month\n                if (exprOn == DAY_OF_MONTH && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(\",\")) {\n                    throw new ParseException(\n                            \"Support for specifying 'L' and 'LW' with other days of the month is not implemented\", -1);\n                }\n                // throw an exception if L is used with other days of the week\n                if (exprOn == DAY_OF_WEEK && expr.indexOf('L') != -1 && expr.length() > 1 && expr.contains(\",\")) {\n                    throw new ParseException(\n                            \"Support for specifying 'L' with other days of the week is not implemented\", -1);\n                }\n                if (exprOn == DAY_OF_WEEK && expr.indexOf('#') != -1\n                        && expr.indexOf('#', expr.indexOf('#') + 1) != -1) {\n                    throw new ParseException(\"Support for specifying multiple \\\"nth\\\" days is not implemented.\", -1);\n                }\n\n                StringTokenizer vTok = new StringTokenizer(expr, \",\");\n                while (vTok.hasMoreTokens()) {\n                    String v = vTok.nextToken();\n                    storeExpressionVals(0, v, exprOn);\n                }\n\n                exprOn++;\n            }\n\n            if (exprOn <= DAY_OF_WEEK) {\n                throw new ParseException(\"Unexpected end of expression.\", expression.length());\n            }\n\n            if (exprOn <= YEAR) {\n                storeExpressionVals(0, \"*\", YEAR);\n            }","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/calendar/CronExpression.java#L485-L521","documentation":"buildExpression rejects a day-of-week field containing more than one '#' character. The '#' operator selects the nth weekday (e.g. FRI#3 = third Friday) and only a single nth-day selector per field is implemented. Thrown as ParseException from buildExpression.","triggerScenarios":"new CronExpression(expr, clockReader) where the day-of-week field contains two or more '#' occurrences, e.g. '0 0 12 ? * MON#1,FRI#3'.","commonSituations":"Trying to express 'first Monday and third Friday' in one cron expression; translating schedules from cron tools that allow multiple nth selectors; misunderstanding that ',' combines whole alternatives rather than multiple '#' specs.","solutions":["Keep at most one '#N' selector in the day-of-week field","Split into multiple timer/job definitions, one per nth-day rule","Replace with explicit dates in day-of-month if the occurrences are computable in advance"],"exampleFix":"// before\nString cron = \"0 0 12 ? * MON#1,FRI#3\"; // unsupported\n// after\nString cron1 = \"0 0 12 ? * MON#1\"; // and a second timer with \"0 0 12 ? * FRI#3\"","handlingStrategy":"validation","validationCode":"String dow = fields[5];\nif (dow.indexOf('#') != dow.lastIndexOf('#')) throw new IllegalArgumentException(\"only one nth-day (#) selector allowed in day-of-week\");","typeGuard":null,"tryCatchPattern":"try { new CronExpression(expr, clockReader); }\ncatch (ParseException e) { if (e.getMessage().contains(\"nth\\\" days\")) { /* split the expression */ } throw e; }","preventionTips":["At most one '#N' per day-of-week field","Model multiple nth-day rules as multiple timer definitions","Prefer simple day lists or ranges where possible"],"tags":["cron","unsupported-feature","flowable","quartz"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}