{"record":{"id":"1aba1eb5d3675511","repo":"flowable/flowable-engine","slug":"illegal-character-after","errorCode":null,"errorMessage":"Illegal character after ?: ","messagePattern":"Illegal character after \\?: ","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":615,"sourceCode":"                        lastdayOfWeek = true;\n                        i++;\n                    }\n                }\n\n            } else {\n                throw new ParseException(\"Illegal characters for this position: '\" + sub + \"'\", i);\n            }\n            if (eval != -1) {\n                incr = 1;\n            }\n            addToSet(sval, eval, incr, type);\n            return (i + 3);\n        }\n\n        if (c == '?') {\n            i++;\n            if ((i + 1) < s.length() && (s.charAt(i) != ' ' && s.charAt(i + 1) != '\\t')) {\n                throw new ParseException(\"Illegal character after '?': \" + s.charAt(i), i);\n            }\n            if (type != DAY_OF_WEEK && type != DAY_OF_MONTH) {\n                throw new ParseException(\"'?' can only be specified for Day-of-Month or Day-of-Week.\", i);\n            }\n            if (type == DAY_OF_WEEK && !lastdayOfMonth) {\n                int val = daysOfMonth.last();\n                if (val == NO_SPEC_INT) {\n                    throw new ParseException(\"'?' can only be specified for Day-of-Month -OR- Day-of-Week.\", i);\n                }\n            }\n\n            addToSet(NO_SPEC_INT, -1, 0, type);\n            return i;\n        }\n\n        if (c == '*' || c == '/') {\n            if (c == '*' && (i + 1) >= s.length()) {\n                addToSet(ALL_SPEC_INT, -1, incr, type);","sourceCodeStart":597,"sourceCodeEnd":633,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/calendar/CronExpression.java#L597-L633","documentation":"Thrown when '?' is followed by a character that is not a space or tab: the parser requires '?' to be the last token of its field, terminated by whitespace or end-of-string. The check tests that the next character is ' ' and the one after is '\\t' (an odd compound condition), and rejects anything else. '?' is only meaningful as a placeholder meaning 'no specific value' in Day-of-Month or Day-of-Week.","triggerScenarios":"new CronExpression(\"0 0 12 ?* * ...\") — '?' immediately followed by more characters ('?*', '?L', '?15'); expression strings with missing spaces after '?'.","commonSituations":"Missing whitespace when concatenating fields programmatically (e.g. \"... ? \" + dow with dow empty or glued); template strings where a separator was dropped; hand-editing an expression and deleting the space after '?'.","solutions":["Ensure '?' is followed by a space or is at the end of the string: '0 0 12 ? * MON' not '0 0 12 ?* MON'.","When building expressions dynamically, always join fields with explicit ' ' separators.","Replace '?' with '*' if you intended 'every value' rather than 'no specific value'.","Validate with CronExpression.validateExpression before saving user-supplied schedules."],"exampleFix":"// before\nnew CronExpression(\"0 0 12 ?* MON\");\n// after\nnew CronExpression(\"0 0 12 ? * MON\");","handlingStrategy":"validation","validationCode":"if (expr.contains(\"?\") && java.util.regex.Pattern.compile(\"\\\\?[^\\\\s]\").matcher(expr).find()) {\n    throw new IllegalArgumentException(\"'?' must be followed by whitespace or end of expression: \" + expr);\n}","typeGuard":null,"tryCatchPattern":"try {\n    new CronExpression(expr);\n} catch (java.text.ParseException e) {\n    if (e.getMessage().contains(\"Illegal character after '?'\")) {\n        log.error(\"Missing space after '?' in cron: {}\", expr);\n    }\n}","preventionTips":["Always separate fields with explicit spaces when building expressions dynamically","Keep '?' as the last token of its field","Normalize whitespace in stored cron strings"],"tags":["cron","parse-error","syntax"],"backgroundTag":"invalid-argument-format","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"}