{"record":{"id":"a8457128d681d0fb","repo":"kestra-io/kestra","slug":"the-isdayweekinmonth-function-could-not-parse","errorCode":null,"errorMessage":"The 'isDayWeekInMonth()' function could not parse 'date': {e.getMessage()}","messagePattern":"The 'isDayWeekInMonth\\(\\)' function could not parse 'date': (.+?)","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java","lineNumber":53,"sourceCode":"        Object dateArg = args.get(\"date\");\n        Object dayOfWeekArg = args.get(\"dayOfWeek\");\n        Object positionArg = args.get(\"position\");\n\n        if (dateArg == null) {\n            throw new PebbleException(null, \"The 'isDayWeekInMonth()' function expects a 'date' argument.\", lineNumber, self.getName());\n        }\n        if (dayOfWeekArg == null) {\n            throw new PebbleException(null, \"The 'isDayWeekInMonth()' function expects a 'dayOfWeek' argument.\", lineNumber, self.getName());\n        }\n        if (positionArg == null) {\n            throw new PebbleException(null, \"The 'isDayWeekInMonth()' function expects a 'position' argument.\", lineNumber, self.getName());\n        }\n\n        LocalDate localDate;\n        try {\n            localDate = DateUtils.parseLocalDate(dateArg.toString());\n        } catch (InternalException e) {\n            throw new PebbleException(e, \"The 'isDayWeekInMonth()' function could not parse 'date': \" + e.getMessage(), lineNumber, self.getName());\n        }\n\n        DayOfWeek dayOfWeek;\n        try {\n            dayOfWeek = DayOfWeek.valueOf(dayOfWeekArg.toString().toUpperCase());\n        } catch (IllegalArgumentException e) {\n            throw new PebbleException(\n                e,\n                \"The 'isDayWeekInMonth()' function received an invalid 'dayOfWeek' value: '\" + dayOfWeekArg\n                    + \"'. Expected one of: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.\",\n                lineNumber, self.getName()\n            );\n        }\n\n        LocalDate computed = switch (positionArg.toString().toUpperCase()) {\n            case \"FIRST\" -> localDate.with(TemporalAdjusters.firstInMonth(dayOfWeek));\n            case \"SECOND\" -> localDate.with(TemporalAdjusters.firstInMonth(dayOfWeek)).plusWeeks(1);\n            case \"THIRD\" -> localDate.with(TemporalAdjusters.firstInMonth(dayOfWeek)).plusWeeks(2);","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java#L35-L71","documentation":"isDayWeekInMonth() could not parse the date argument with DateUtils.parseLocalDate; the value is not a recognizable ISO 8601 date or datetime. The wrapped InternalException message gives the parse detail.","triggerScenarios":"Passing date like '2024-13-01' (invalid month), '01/15/2024' (US order, slashes), 'tomorrow', or an empty/blank string.","commonSituations":"Locale-specific date formats (DD/MM/YYYY or MM/DD/YYYY), relative words, or a templated value that rendered to something unexpected.","solutions":["Provide an ISO 8601 date ('YYYY-MM-DD') or datetime ('YYYY-MM-DDTHH:mm:ss').","Pre-format the date before passing, e.g. with a date filter.","Inspect the appended parse error message for the exact failure."],"exampleFix":"// before\n{{ isDayWeekInMonth(date='15/01/2024', dayOfWeek='MONDAY', position='FIRST') }}\n// after\n{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY', position='FIRST') }}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass dates in ISO 8601 form: 'YYYY-MM-DD' or 'YYYY-MM-DDTHH:mm:ss'.","Pre-format locale-specific dates into ISO form before passing them in.","Inspect the appended parse error message for the exact failing token."],"tags":["pebble","date","parsing","iso8601"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}