{"record":{"id":"18f5a32975be4b72","repo":"kestra-io/kestra","slug":"the-isdayweekinmonth-function-received-an-inva","errorCode":null,"errorMessage":"The 'isDayWeekInMonth()' function received an invalid 'dayOfWeek' value: '{dayOfWeekArg}'. Expected one of: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.","messagePattern":"The 'isDayWeekInMonth\\(\\)' function received an invalid 'dayOfWeek' value: '(.+?)'\\. Expected one of: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java","lineNumber":60,"sourceCode":"        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);\n            case \"FOURTH\" -> localDate.with(TemporalAdjusters.firstInMonth(dayOfWeek)).plusWeeks(3);\n            case \"LAST\" -> localDate.with(TemporalAdjusters.lastInMonth(dayOfWeek));\n            default -> throw new PebbleException(\n                null, \"The 'isDayWeekInMonth()' function received an invalid 'position' value: '\" + positionArg + \"'. Expected one of: FIRST, SECOND, THIRD, FOURTH, LAST.\", lineNumber,\n                self.getName()\n            );\n        };","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java#L42-L78","documentation":"The dayOfWeek argument must be one of MONDAY…SUNDAY (case-insensitive). DayOfWeek.valueOf threw, so the value did not match an enum constant.","triggerScenarios":"Passing dayOfWeek='MON' (3-letter abbreviation), 'Wed' (mixed case, abbreviated), 'Wednesday' is fine in full uppercase, but 'WED' or a typo is not.","commonSituations":"Using 3-letter abbreviations or full lower-case/mixed-case words instead of the uppercase full enum name.","solutions":["Use the full uppercase day name: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY.","If the value comes from a variable, upper-case it: dayOfWeek=myVar|upper."],"exampleFix":"// before\n{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='Wed', position='FIRST') }}\n// after\n{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='WEDNESDAY', position='FIRST') }}","handlingStrategy":"validation","validationCode":"{% set d = dayOfWeek|upper %}{% if d in ['MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY'] %}{{ isDayWeekInMonth(date=myDate, dayOfWeek=d, position='FIRST') }}{% endif %}","typeGuard":"{% macro is_valid_day(d) %}{{ d|upper in ['MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY','SATURDAY','SUNDAY'] }}{% endmacro %}","tryCatchPattern":null,"preventionTips":["Use the full uppercase day name (MONDAY … SUNDAY), never 3-letter abbreviations.","Upper-case values from variables with the 'upper' filter before passing."],"tags":["pebble","date","enum","validation"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}