{"record":{"id":"b5c2b2e82b595fc8","repo":"flowable/flowable-engine","slug":"unexpected-end-of-expression","errorCode":null,"errorMessage":"Unexpected end of expression.","messagePattern":"Unexpected end of expression\\.","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":516,"sourceCode":"                    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            }\n\n            TreeSet<Integer> dow = getSet(DAY_OF_WEEK);\n            TreeSet<Integer> dom = getSet(DAY_OF_MONTH);\n\n            // Copying the logic from the UnsupportedOperationException below\n            boolean dayOfMSpec = !dom.contains(NO_SPEC);\n            boolean dayOfWSpec = !dow.contains(NO_SPEC);\n\n            if (!dayOfMSpec || dayOfWSpec) {\n                if (!dayOfWSpec || dayOfMSpec) {\n                    throw new ParseException(\n                            \"Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.\",\n                            0);","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/calendar/CronExpression.java#L498-L534","documentation":"After tokenizing the six standard fields, buildExpression checks exprOn; if it did not get past DAY_OF_WEEK, the expression had fewer than the required fields (second minute hour day-of-month month day-of-week). The parser requires at least 6 fields; year is the only optional field. Thrown as ParseException with the expression length as offset.","triggerScenarios":"new CronExpression(expr, clockReader) with 5 or fewer space-separated fields, e.g. '0 0 12 * *' (unix-style 5-field cron) passed where a 6-field Quartz-style cron is required.","commonSituations":"Copying standard Unix crontab lines (5 fields) into Flowable timer definitions; losing a field when editing BPMN XML; whitespace/formatting issues that collapse an empty field.","solutions":["Add the missing seconds field (and day-of-week) — Quartz cron needs 6 or 7 fields: '0 0 12 * * ?' not '0 0 12 * *'","Use '?' for whichever of day-of-month/day-of-week is unrestricted","Pre-validate field count with expression.trim().split(\"\\\\s+\").length >= 6 before constructing","If it must stay 5-field unix cron, convert it explicitly to Quartz format"],"exampleFix":"// before\nString cron = \"0 0 12 * *\"; // 5 fields — unix style\n// after\nString cron = \"0 0 12 * * ?\"; // 6 fields — Quartz/Flowable style (seconds added, day-of-week '?')","handlingStrategy":"validation","validationCode":"int n = expr == null ? 0 : expr.trim().split(\"\\\\s+\").length;\nif (n < 6 || n > 7) throw new IllegalArgumentException(\"Quartz cron needs 6 or 7 fields, got \" + n + \": \" + expr);","typeGuard":null,"tryCatchPattern":"try { new CronExpression(expr, clockReader); }\ncatch (ParseException e) { if (e.getMessage().contains(\"Unexpected end\")) { /* add missing fields */ } throw e; }","preventionTips":["Remember Flowable/Quartz cron always includes a seconds field (unlike Unix cron)","Count fields in config linting before deployment","Convert 5-field unix crontab entries explicitly with a leading '0' seconds field and '?' day fields"],"tags":["cron","format","flowable","quartz"],"backgroundTag":"invalid-cron-expression","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"}