{"record":{"id":"b984e60aa9bf9990","repo":"kestra-io/kestra","slug":"the-isdayweekinmonth-function-expects-a-posit","errorCode":null,"errorMessage":"The 'isDayWeekInMonth()' function expects a 'position' argument.","messagePattern":"The 'isDayWeekInMonth\\(\\)' function expects a 'position' argument\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"critical","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java","lineNumber":46,"sourceCode":" * @param position occurrence within the month: {@code FIRST}, {@code SECOND}, {@code THIRD}, {@code FOURTH}, or {@code LAST}\n */\npublic class IsDayWeekInMonthFunction implements KestraFunction {\n    public static final String NAME = \"isDayWeekInMonth\";\n\n    @Override\n    public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {\n        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()","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/IsDayWeekInMonthFunction.java#L28-L64","documentation":"The isDayWeekInMonth() function requires three arguments — date, dayOfWeek, position. This fires when position is null or missing.","triggerScenarios":"Calling isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY') without position.","commonSituations":"Omitted argument, or a templated position that resolved to null.","solutions":["Pass a valid position keyword (FIRST, SECOND, THIRD, FOURTH, or LAST).","Guard templated values before calling."],"exampleFix":"// before\n{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY') }}\n// after\n{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY', position='FIRST') }}","handlingStrategy":"validation","validationCode":"{% if myPosition is not empty %}{{ isDayWeekInMonth(date='2024-01-15', dayOfWeek='MONDAY', position=myPosition) }}{% endif %}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass all three arguments (date, dayOfWeek, position).","Guard templated position values with 'is not empty' before calling."],"tags":["pebble","date","argument","required-arg"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}